Hi all! Proposed patch to PR100018 - ICE on missing polymorphic argument.
Patch tested only on x86_64-pc-linux-gnu. Add association check before de-referencing pointer in order to avoid ICE. Thank you very much. Best regards, José Rui 2021-4-10 José Rui Faustino de Sousa <jrfso...@gmail.com> 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.
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 1c9b0c5cb62..dd4b26680e0 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -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 diff --git a/gcc/testsuite/gfortran.dg/PR10018.f90 b/gcc/testsuite/gfortran.dg/PR10018.f90 new file mode 100644 index 00000000000..f1cf2676f85 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/PR10018.f90 @@ -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 }