public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "sgk at troutmask dot apl.washington.edu" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/110825] TYPE(*) dummy argument to generate an unused hidden argument Date: Wed, 26 Jul 2023 22:00:41 +0000 [thread overview] Message-ID: <bug-110825-4-43JfHFOHHr@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-110825-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110825 --- Comment #3 from Steve Kargl <sgk at troutmask dot apl.washington.edu> --- On Wed, Jul 26, 2023 at 08:54:01PM +0000, anlauf at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110825 > > --- Comment #1 from anlauf at gcc dot gnu.org --- > (In reply to kargl from comment #0) > > Thus, when compiled and executed the program hits 'STOP 1'. Likely, > > gfortran needs to add a possibly unused hidden argument to the argument list > > for a TYPE(*) dummy argument. > > I guess it should be the other way around: if the dummy argument is TPYE(*), > we only pass a reference to the actual argument, but no hidden argument, > as is the case for bind(c). This is also what the called procedure expects. I had not thought about how gfortran handles bind(c). In my codes that use bind(c), I use an array with character(len=1) with the last element set to c_null_char. On the C side, it looks like a C null-terminated string. I don't use type(*) in my codes, so I'm unsure how, or even if, the length type parameter would/(need to) be passed along. > What if the caller passed a type other than character? That's why I wrote '***possibly unused*** hidden argument' > So we just need to update the caller (the "monster" gfc_conv_procedure_call). > > Do you have an idea what would be the use of the hidden argument here anyway? Hmmm, a scan of F2018 suggest that type(*) has rather limited uses C710 An assumed-type variable name shall not appear in a designator or expression except as an actual argument corresponding to a dummy argument that is assumed-type, or as the first argument to the intrinsic function IS_CONTIGUOUS, LBOUND, PRESENT, RANK, SHAPE, SIZE, or UBOUND, or the function C_LOC from the intrinsic module ISO_C_BINDING. I suspect that a hidden argument isn't needed. This means that gfc_conv_procedure_call will need to suppress a hidden argument for a type(*) dummy argument when the actual argument is of character type. > As TYPE(*) is rather new, and I did not find any mentioning of it in the > ABI specification, we should clarify what we want and also document it at > > https://gcc.gnu.org/onlinedocs/gfortran/Argument-passing-conventions.html Sorry, I cannot be of much help. type(*) is well off my radar for my owns codes.
next prev parent reply other threads:[~2023-07-26 22:00 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-07-26 20:17 [Bug fortran/110825] New: " kargl at gcc dot gnu.org 2023-07-26 20:17 ` [Bug fortran/110825] " kargl at gcc dot gnu.org 2023-07-26 20:54 ` anlauf at gcc dot gnu.org 2023-07-26 21:18 ` anlauf at gcc dot gnu.org 2023-07-26 22:00 ` sgk at troutmask dot apl.washington.edu [this message] 2023-07-27 19:41 ` anlauf at gcc dot gnu.org 2023-07-28 18:40 ` cvs-commit at gcc dot gnu.org 2023-07-30 18:28 ` cvs-commit at gcc dot gnu.org 2023-08-17 20:28 ` anlauf at gcc dot gnu.org
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=bug-110825-4-43JfHFOHHr@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@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: linkBe 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).