diff options
author | Harald Anlauf <anlauf@gmx.de> | 2019-12-21 20:25:43 +0000 |
---|---|---|
committer | Harald Anlauf <anlauf@gcc.gnu.org> | 2019-12-21 20:25:43 +0000 |
commit | b5fd86aba81ec7dbd50e588909f81771841c03bd (patch) | |
tree | 77e8c8ca0ef693c34fb279613a97e2bf87620da4 /gcc/fortran/match.c | |
parent | b1f16cae7dda8111a41bd351be63c808d593546d (diff) | |
download | gcc-b5fd86aba81ec7dbd50e588909f81771841c03bd.zip gcc-b5fd86aba81ec7dbd50e588909f81771841c03bd.tar.gz gcc-b5fd86aba81ec7dbd50e588909f81771841c03bd.tar.bz2 |
re PR fortran/92990 (INVALID code with NULLIFY – partially misleading error message "If bounds remapping is specified at (1), the pointer target shall not be NULL")
2019-12-21 Harald Anlauf <anlauf@gmx.de>
PR fortran/92990
* match.c (gfc_match_nullify): Check for valid pointer object.
Reject bounds remapping.
PR fortran/92990
* gfortran.dg/pr92990.f90: New test.
From-SVN: r279698
Diffstat (limited to 'gcc/fortran/match.c')
-rw-r--r-- | gcc/fortran/match.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c index d3e3abc..b467d99 100644 --- a/gcc/fortran/match.c +++ b/gcc/fortran/match.c @@ -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); |