[PATCH] fortran/66043 -- Check for NULL() in STORAGE_SIZE()
Steve Kargl
sgk@troutmask.apl.washington.edu
Fri May 15 16:03:00 GMT 2015
On Fri, May 15, 2015 at 05:34:14PM +0200, FX wrote:
> Hi Steve,
>
> + gfc_error ("%qs argument of %qs intrinsic at %L shall not be an "
> + "unallocated allocatable variable or a disassociated or "
> + "undefined pointer???,
>
> Given that we know explicitly that the expr is NULL, wouldn't
> it be nicer to give only the relevant condition (here, I guess
> it's "undefined pointer")?
The text above is essentially the wording from the standard.
I was unsure if I could catch all types of errors when I wrote
the error string.
I can change the error to something like
"Intrinsic function NULL() cannot be an actual argument to
STORAGE_SIZE because it returns a disassociated pointer"
>
> Regarding the other example mention in the PR's comment #2,
> I guess there's no requirement for the compiler to diagnose
> this, is there?
>
No. This isn't a numbered constraint. I spent an hour or so
tracing though parent namespaces and symbol trees to see if
I could catch the problem in comment #2. I think that this
would require a runtime error (or adding an internal attribute
that explicitly tracks associate/disassociation and
allocation/deallocation).
--
Steve
More information about the Gcc-patches
mailing list