public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* ABI question: character, value, optional dummy argument [PR107444]
@ 2022-11-01 21:13 Harald Anlauf
  0 siblings, 0 replies; only message in thread
From: Harald Anlauf @ 2022-11-01 21:13 UTC (permalink / raw)
  To: fortran

Dear all,

I apologize in advance in case I did not do sufficient research,
but I need feedback on a question regarding the ABI that does not
seem handled by

https://gcc.gnu.org/onlinedocs/gfortran/Argument-passing-conventions.html

How do we determine if an actual argument corresponding to a
character, value, optional dummy argument is present or not?

subroutine s (c)
  character, value, optional :: c
end

gets translated on x86_64-pc-linux-gnu to

void s (character(kind=1)[1:1] c, integer(kind=8) _c)

We could:

- add a hidden logical argument for the present status as done for
  other types (this would clearly be an explicit ABI change)

- use the passed character length: if it is > 0, then the argument
  is present, otherwise it is not.
  (This may require dealing with invalid code, where invocation of
  the subroutine with a character(len=0) actual argument is either
  diagnosed as done by the NAG compiler, or treated as undefined
  behavior.)

Thanks,
Harald


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-11-01 21:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-01 21:13 ABI question: character, value, optional dummy argument [PR107444] Harald Anlauf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).