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/104332] [9/10/11/12 Regression] ICE in resolve_symbol, at fortran/resolve.cc:15815
Date: Tue, 01 Feb 2022 20:53:14 +0000 [thread overview]
Message-ID: <bug-104332-4-GSgFAwFvOR@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-104332-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104332
--- Comment #4 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Tue, Feb 01, 2022 at 08:04:45PM +0000, kargl at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104332
>
> kargl at gcc dot gnu.org changed:
>
> What |Removed |Added
> ----------------------------------------------------------------------------
> Ever confirmed|0 |1
> Status|UNCONFIRMED |NEW
> Last reconfirmed| |2022-02-01
>
> --- Comment #3 from kargl at gcc dot gnu.org ---
> (In reply to G. Steinmetz from comment #0)
> > Affects versions down to r8 (ifort/ifx rejects it) :
> >
> >
> > $ cat z1.f90
> > block data
> > bind(c) a
> > end
> >
>
> This fixes the ICE by avoiding a NULL pointer dereference.
>
> diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc
> index 835a4783718..0ea68c707a0 100644
> --- a/gcc/fortran/resolve.cc
> +++ b/gcc/fortran/resolve.cc
> @@ -15812,8 +15815,9 @@ resolve_symbol (gfc_symbol *sym)
>
> /* First, make sure the variable is declared at the
> module-level scope (J3/04-007, Section 15.3). */
> - if (sym->ns->proc_name->attr.flavor != FL_MODULE &&
> - sym->attr.in_common == 0)
> + if (sym->ns->proc_name
> + && sym->ns->proc_name->attr.flavor != FL_MODULE
> + && sym->attr.in_common == 0)
> {
> gfc_error ("Variable %qs at %L cannot be BIND(C) because it "
> "is neither a COMMON block nor declared at the "
OK. So, the above stops the ICE, but allows the code to compile,
which is bad. The code is invalid by C819. From C1415, the
BIND statement would apply to a common block. Thus, the following
is valid code
block data
common /a/x
bind(c) :: /a/
end block data
next prev parent reply other threads:[~2022-02-01 20:53 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-01 17:41 [Bug fortran/104332] New: " gscfq@t-online.de
2022-02-01 17:42 ` [Bug fortran/104332] " gscfq@t-online.de
2022-02-01 19:14 ` kargl at gcc dot gnu.org
2022-02-01 20:04 ` kargl at gcc dot gnu.org
2022-02-01 20:04 ` kargl at gcc dot gnu.org
2022-02-01 20:53 ` sgk at troutmask dot apl.washington.edu [this message]
2022-02-02 7:12 ` rguenth at gcc dot gnu.org
2022-05-27 9:47 ` [Bug fortran/104332] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:47 ` jakub at gcc dot gnu.org
2023-03-08 21:59 ` anlauf at gcc dot gnu.org
2023-03-09 18:08 ` anlauf at gcc dot gnu.org
2023-03-10 17:56 ` cvs-commit at gcc dot gnu.org
2023-03-15 20:46 ` cvs-commit at gcc dot gnu.org
2023-03-17 20:40 ` cvs-commit at gcc dot gnu.org
2023-03-17 20:41 ` cvs-commit at gcc dot gnu.org
2023-03-17 20:42 ` 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-104332-4-GSgFAwFvOR@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).