Message ID | trinity-04f1f93b-4e99-442d-b95d-55002a34312c-1576877624076@3c-app-gmx-bs73 |
---|---|
State | New |
Headers | show |
Series | PR92990 - fix error message for invalid argument of NULLIFY | expand |
Am 20.12.19 um 22:33 schrieb Harald Anlauf: > The fix for PR70853 changed an ICE-on-invalid for NULLIFY into a > misleading error message. The patch below rectifies that. > > OK for trunk? OK. Thanks for the patch! Regards Thomas
> Gesendet: Samstag, 21. Dezember 2019 um 17:16 Uhr > Von: "Thomas Koenig" <tkoenig@netcologne.de> > An: "Harald Anlauf" <anlauf@gmx.de>, fortran <fortran@gcc.gnu.org>, gcc-patches <gcc-patches@gcc.gnu.org> > Betreff: Re: [Patch] PR92990 - fix error message for invalid argument of NULLIFY > > Am 20.12.19 um 22:33 schrieb Harald Anlauf: > > The fix for PR70853 changed an ICE-on-invalid for NULLIFY into a > > misleading error message. The patch below rectifies that. > > > > OK for trunk? > > OK. > > Thanks for the patch! > > Regards > > Thomas > Committed as rev.279698. Thanks for the review! Harald
Index: gcc/fortran/match.c =================================================================== --- gcc/fortran/match.c (Revision 279645) +++ gcc/fortran/match.c (Arbeitskopie) @@ -4588,6 +4588,23 @@ gfc_match_nullify (void) goto cleanup; } + /* Check for valid array pointer object. Bounds remapping is not + allowed with NULLIFY. */ + if (p->ref) + { + gfc_ref *remap = p->ref; + for (; remap; remap = remap->next) + if (!remap->next && remap->type == REF_ARRAY + && remap->u.ar.type != AR_FULL) + break; + if (remap) + { + gfc_error ("NULLIFY does not allow bounds remapping for " + "pointer object at %C"); + goto cleanup; + } + } + /* build ' => NULL() '. */ e = gfc_get_null_expr (&gfc_current_locus); Index: gcc/testsuite/gfortran.dg/pr92990.f90 =================================================================== --- gcc/testsuite/gfortran.dg/pr92990.f90 (nicht existent) +++ gcc/testsuite/gfortran.dg/pr92990.f90 (Arbeitskopie) @@ -0,0 +1,12 @@ +! { dg-do compile } +! PR fortran/92990 +! Verify fix of error message for NULLIFY vs. pointer assignment (PR70853) +program p + integer, pointer :: x(:) + type t + integer, pointer :: y(:) + end type t + type(t) :: z + nullify (x(1:2)) ! { dg-error "does not allow bounds remapping" } + nullify (z%y(:)) ! { dg-error "does not allow bounds remapping" } +end