https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125724

--- Comment #8 from Harald Anlauf <anlauf at gcc dot gnu.org> ---
(In reply to Jerry DeLisle from comment #7)
> 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?

No, I don't think you can do anything at compile time.

But the ALLOCATE is invalid.  You can allocate a variable, but not an
expression.  To handle this, we'd need to somehow annotate the array
descriptor.  But this is a separate issue.

Just remove the invalid code starting with the ALLOCATE.

Reply via email to