Fortran: Fix ICE due to referencing a NULL pointer [PR100018]

gcc/fortran/ChangeLog:

	PR fortran/100018
	* resolve.c: Add association check before de-referencing pointer.

gcc/testsuite/ChangeLog:

	PR fortran/100018
	* gfortran.dg/PR10018.f90: New test.
This commit is contained in:
José Rui Faustino de Sousa 2021-04-16 16:17:21 +00:00
parent 8535755af7
commit 98c5b5924d
2 changed files with 12 additions and 0 deletions

View File

@ -11999,6 +11999,7 @@ start:
/* Assigning a class object always is a regular assign. */
if (code->expr2->ts.type == BT_CLASS
&& code->expr1->ts.type == BT_CLASS
&& CLASS_DATA (code->expr2)
&& !CLASS_DATA (code->expr2)->attr.dimension
&& !(gfc_expr_attr (code->expr1).proc_pointer
&& code->expr2->expr_type == EXPR_VARIABLE

View File

@ -0,0 +1,11 @@
! { dg-do compile }
!
subroutine foo(that)
implicit none
class(*), target, intent(in) :: this
class(*), pointer, intent(out) :: that
that => this
return
end subroutine foo
! { dg-error "Symbol at \\\(1\\\) is not a DUMMY variable" "" { target "*-*-*" } 5 }