public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Thomas Koenig <tkoenig@netcologne.de>
To: Harald Anlauf <anlauf@gmx.de>, fortran <fortran@gcc.gnu.org>,
	gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Fortran: procedures with BIND(C) attribute require explicit interface [PR85877]
Date: Sat, 18 Mar 2023 19:52:14 +0100	[thread overview]
Message-ID: <3496724e-5ebd-d133-c6f6-807068b175f4@netcologne.de> (raw)
In-Reply-To: <trinity-7cc4f143-7033-4551-af8d-b4fbe021637d-1679089003636@3c-app-gmx-bs05>

Hi Harald,

> the Fortran standard requires an explicit procedure interface in certain
> situations, such as when they have a BIND(C) attribute (F2018:15.4.2.2).
> The attached patch adds a check for this.
> 
> Regtested on x86_64-pc-linux-gnu.  OK for mainline?

While this fixes the ICE, it misses

function f() bind(c)
   f = 42.
end

subroutine p
   bind(c) f     ! { dg-error "must be explicit" }
   x = f()
end

subroutine s
   interface
      function g() bind(c)
      end function g
   end interface
   x = g()
end

where the interface is picked up via a global symbol.  This code
may not be valid; nagfor rejects it, but I cannot find a
constraint at least in the F2022 draft that prohibits it.

Hm... might it be better to check for attr->module_procedure ||
attr->if_source == IFSRC_IFBODY?

Best regards

	Thomas


  reply	other threads:[~2023-03-18 18:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-17 21:36 Harald Anlauf
2023-03-18 18:52 ` Thomas Koenig [this message]
2023-03-18 20:59   ` Harald Anlauf
2023-03-19  7:34     ` Thomas Koenig
2023-03-19 19:38       ` Harald Anlauf

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=3496724e-5ebd-d133-c6f6-807068b175f4@netcologne.de \
    --to=tkoenig@netcologne.de \
    --cc=anlauf@gmx.de \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@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).