re PR fortran/59502 ([OOP] ICE on invalid on pointer assignment to non-pointer CLASS)

2013-12-14  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/59502
	* primary.c (gfc_match_varspec): Check for 'class_ok'.


2013-12-14  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/59502
	* gfortran.dg/class_57.f90: New.

From-SVN: r205990
This commit is contained in:
Janus Weil 2013-12-14 18:47:22 +01:00
parent 4eca178ac8
commit 156c01601d
4 changed files with 36 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2013-12-14 Janus Weil <janus@gcc.gnu.org>
PR fortran/59502
* primary.c (gfc_match_varspec): Check for 'class_ok'.
2013-12-14 Janus Weil <janus@gcc.gnu.org>
PR fortran/59450

View File

@ -2039,9 +2039,8 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag,
if (m != MATCH_YES)
return m;
}
else if (component->ts.type == BT_CLASS
&& CLASS_DATA (component)->as != NULL
&& !component->attr.proc_pointer)
else if (component->ts.type == BT_CLASS && component->attr.class_ok
&& CLASS_DATA (component)->as && !component->attr.proc_pointer)
{
tail = extend_ref (primary, tail);
tail->type = REF_ARRAY;

View File

@ -1,3 +1,8 @@
2013-12-14 Janus Weil <janus@gcc.gnu.org>
PR fortran/59502
* gfortran.dg/class_57.f90: New.
2013-12-14 H.J. Lu <hongjiu.lu@intel.com>
PR target/59492

View File

@ -0,0 +1,24 @@
! { dg-do compile }
!
! PR 59502: [OOP] ICE on invalid on pointer assignment to non-pointer CLASS
!
! Contributed by Andrew Benson <abensonca@gmail.com>
implicit none
type :: d
end type
type :: p
class(d) :: cc ! { dg-error "must be allocatable or pointer" }
end type
contains
function pc(pd)
type(p) :: pc
class(d), intent(in), target :: pd
pc%cc => pd ! { dg-error "Non-POINTER in pointer association context" }
end function
end