[J3] [EXTERNAL] [BULK] Re: Question on dummy CLASS(*) pointer arguments
Clune, Thomas L. (GSFC-6101)
thomas.l.clune at nasa.gov
Fri Dec 8 16:09:19 UTC 2023
Not sure how much more detail I can offer.
With the extension that I suggested, then there would be more cases where one could enforce that actual arguments have TARGET attribute. (I.e., compilation error if it does not.) Without that extensions, then if the actual argument is missing the TARGET attribute, one will get a semi obscure runtime error message. How obscure it is, often depends on how much later the dangling thingo is then referenced.
These generally only happen with one compiler, and even then only with debugging on. Unfortunately, my team mostly develops with other compilers which then leaves me with the occasional odd week to track down accumulated non-standard usage that are not breaking anything else. The term pyrrhic victory comes to mind.
This particular case is actually quite rare. My common case is when the passed object dummy requires the actual to have the target attribute. This is all over the place in my containers as those generally return pointers to items in the container. But allowing POINTER on the passed object is probably a nonstarter, even for INTENT(IN). Have spent probably about 10 hours tracing bugs of this sort this week.
I think the rest of my team (~ 7 developers) would be just fine if I stopped using aid compiler. But it is my favorite for development.
Does that give you what you want?
* Tom
From: J3 <j3-bounces at mailman.j3-fortran.org> on behalf of j3 <j3 at mailman.j3-fortran.org>
Reply-To: j3 <j3 at mailman.j3-fortran.org>
Date: Friday, December 8, 2023 at 10:52 AM
To: j3 <j3 at mailman.j3-fortran.org>
Cc: Vipul Parekh <parekhvs at gmail.com>
Subject: [EXTERNAL] [BULK] Re: [J3] Question on dummy CLASS(*) pointer arguments
CAUTION: This email originated from outside of NASA. Please take care when clicking links or opening attachments. Use the "Report Message" button to report suspicious messages to the NASA SOC.
Tom,
Will it be possible for you to provide some closing thoughts on this particular matter from perspective and/or NASA colleagues as users of Fortran?
You saw the feedback from the Fortran standard point-of-view, "Making this valid would probably require a lot of extra words to make sure nothing gets broken. It is certainly not obvious that there is any functionality here worth the additional complication of the language."
So where does this leave the practitioners of Fortran? Especially in the context of working with program data, e.g., with NASA's use case, "The code in question is part of asynchronous communication layer in which I save addresses of arrays (C_LOC) which are then copied upon a signal at a later time."
Also, can you please elaborate further re: "semi-obscure run-time errors"? For example, with your statement:
"The current code does use TARGET for the dummy argument but results in semi-obscure run time errors when the actual argument does not have the TARGET attribute." You need not get into any specific compiler names here if you do not wish to do so.
Thanks,
Vipul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20231208/6c4260a6/attachment.htm>
More information about the J3
mailing list