public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Harald Anlauf <anlauf@gmx.de>
To: fortran <fortran@gcc.gnu.org>
Subject: ABI question: character, value, optional dummy argument [PR107444]
Date: Tue, 1 Nov 2022 22:13:16 +0100	[thread overview]
Message-ID: <trinity-b96a81cd-3032-49ed-b536-5a06d273da23-1667337196391@3c-app-gmx-bap32> (raw)

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	other threads:[~2022-11-01 21:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=trinity-b96a81cd-3032-49ed-b536-5a06d273da23-1667337196391@3c-app-gmx-bap32 \
    --to=anlauf@gmx.de \
    --cc=fortran@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).