[J3] Question on iomsg in DTIO

Malcolm Cohen malcolm at nag-j.co.jp
Tue Mar 19 03:14:46 UTC 2024


Hi Reinhold,

 

Yes, well we knew when we added auto-reallocation that it was not
backwards-compatible.

 

Brad's suggestion of allowing allocatable and ordinary arguments to coexist
in a generic would need a fair bit of work, as it unfortunately opens the
barn doors very wide to ambiguities. It is also not actually necessary to
add the full feature *IF* we just want to fix this. And deciding to do this
suggestion would be new feature design, and thus Fortran 202y and DATA
subgroup. 

 

And the obvious answer here is to treat an unallocated IOMSG= argument as
one that is missing. That's how normal procedure calls work. Yes, the i/o
statement is not a "normal procedure call", but in the end the procedure is
"called normally", so although the words are not explicit (but then much of
the new auto-realloc is done by vague handwaving), it is a reasonable
deduction.

 

With that answer, LEN(IOMSG) in the defined i/o procedure would be equal to
whatever it is when there is no IOMSG= specifier in the i/o statement. That
is already allowed, and the LEN(IOMSG) in the routine is processor-dependent
in that case.

 

Then, to integrate with the new auto-realloc scheme, we just have the
processor assign it afterwards (but only with nonzero IOSTAT, of course),
allocating it to LEN_TRIM of the returned message (which might have been
truncated if the user assigned a ridiculously long message to what is a
buffer designed for holding the processor's i/o messages). The words in the
standard already imply this, I think.

 

The main thing missing would appear to be an explicit description of what an
unallocated allocatable means for defined i/o. The rest is, I think, already
there.

 

I note that this solution is not one of your suggested resolution. However,
it is, I think, what the features we have imply should happen. As has
happened so often in the past, we added a new feature but neglected to
describe it hyper-rigorously because "we all know what it means", and thus
missed out describing it properly.

 

Cheers,

-- 

..............Malcolm Cohen, NAG Oxford/Tokyo.

 

From: J3 <j3-bounces at mailman.j3-fortran.org> On Behalf Of Bader, Reinhold
via J3
Sent: Monday, March 18, 2024 8:03 PM
To: General J3 interest list <j3 at mailman.j3-fortran.org>
Cc: Bader, Reinhold <Reinhold.Bader at lrz.de>
Subject: [J3] Question on iomsg in DTIO

 

Dear all, 

 

attached a draft paper for which I'd like some feedback (especially from
/interp) before I submit it to the J3 

site.

 

Cheers

Reinhold

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20240319/f387e699/attachment.htm>


More information about the J3 mailing list