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

Reply via email to