https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92990
Bug ID: 92990
Summary: INVALID code with NULLIFY – partially misleading error
message "If bounds remapping is specified at (1), the
pointer target shall not be NULL"
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: burnus at gcc dot gnu.org
CC: anlauf at gcc dot gnu.org
Target Milestone: ---
Follow up to https://gcc.gnu.org/ml/fortran/2019-12/msg00161.html / patch for
PR70853 (r279527):
The following variant now no longer gives an ICE, but there is room for
improvement for the error message. Internally "=> NULL()" and NULLIFY are the
same – and the issue is also the same. Still, the message is somewhat puzzling.
Possibly, this can already be handled in gfc_match_nullify?
xxxxx.f90:2:8:
2 | nullify(x(1:1))
| 1
Error: If bounds remapping is specified at (1), the pointer target shall
not be NULL
As Harald wrote: "For a better error message, we'd need to know that we come
here from a NULLIFY statement."
Test case:
integer, pointer, contiguous :: x(:)
nullify(x(1:1))
end