public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "anlauf at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/95879] [10/11/12 Regression] ICE in gfc_resolve_formal_arglist, at fortran/resolve.c:313
Date: Wed, 05 Jan 2022 22:36:41 +0000	[thread overview]
Message-ID: <bug-95879-4-v31gvrAWZa@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-95879-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95879

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |anlauf at gcc dot gnu.org

--- Comment #6 from anlauf at gcc dot gnu.org ---
(In reply to sandra from comment #5)
> The ICE from the z1.90 example is gone on mainline now.  I don't know if the
> error on y1.f90 is correct or not without further research.

y1.f90 is invalid code.  However, gfortran's checking looks suspicious to me.

Rewriting the testcase slightly:

module m
  implicit none
contains
  integer function f(x) bind(c)
    use iso_c_binding, only: c_funloc
    real, intent(in) :: x
    c_funloc(f) = x
    f = 0
  end
end

This would give:

pr95879-y1.f90:7:13:

    7 |     c_funloc(f) = x
      |             1
Error: Function result 'f' at (1) is invalid as X argument to C_FUNLOC

I think this is wrong.

F2018: 18.2.3.5  C_FUNLOC (X)

Argument. X shall be a procedure; if it is a procedure pointer it shall be
associated. It shall not be a coindexed object.

Deactivating the related check in gfc_check_c_funloc, I get:

pr95879-y1.f90:7:4:

    7 |     c_funloc(f) = x
      |    1
Error: The function result on the lhs of the assignment at (1) must have the
pointer attribute.

That looks like a more reasonable error.

  parent reply	other threads:[~2022-01-05 22:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-24 18:49 [Bug fortran/95879] New: [10/11 Regression] ICE in gfc_get_derived_type, at fortran/trans-types.c:2729 gscfq@t-online.de
2020-06-24 18:50 ` [Bug fortran/95879] " gscfq@t-online.de
2020-06-25  7:10 ` [Bug fortran/95879] [10/11 Regression] ICE in gfc_resolve_formal_arglist, at fortran/resolve.c:313 marxin at gcc dot gnu.org
2020-06-25  7:35 ` rguenth at gcc dot gnu.org
2020-07-23  6:51 ` rguenth at gcc dot gnu.org
2020-10-12 12:51 ` rguenth at gcc dot gnu.org
2021-04-08 12:02 ` rguenth at gcc dot gnu.org
2022-01-05 17:37 ` [Bug fortran/95879] [10/11/12 " sandra at gcc dot gnu.org
2022-01-05 22:36 ` anlauf at gcc dot gnu.org [this message]
2022-06-28 10:41 ` [Bug fortran/95879] [10/11/12/13 " jakub at gcc dot gnu.org
2023-07-07 10:37 ` [Bug fortran/95879] [11/12/13/14 " rguenth 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-95879-4-v31gvrAWZa@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: 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).