https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125724
--- Comment #7 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
For my system here flang issues a warning. At -std=f2003 we issue errors. At
f2008 and above we are accepting it with no warning (ie. patch applied). NAG is
stricter in their interpretation.
>From my draft copy of the 2023 standard:
I read 15.5.2.7 ("Allocatable dummy variables") and the NULL() description
(16.9.155 / Table 16.5) in the F2023 draft (24-007.pdf):
- 15.5.2.7 ¶2: "The actual argument shall be allocatable. It is permissible for
the actual argument to have an allocation status of unallocated." — no
INTENT(IN)/OPTIONAL qualifier here.
- Table 16.5: when NULL() (no MOLD) appears as an actual argument, its
characteristics are those of "the corresponding dummy argument" — i.e., it
becomes "an unallocated allocatable entity" of the dummy's type/rank.
My impression is that the test case is valid. It may be subject to
interpretation and I think this is why flang gives a warning.
Harald, do you think we should give some sort of warning?