public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "kargl at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/99368] ICE in build_function_decl, at fortran/trans-decl.c:2381 Date: Sun, 01 Aug 2021 17:04:25 +0000 [thread overview] Message-ID: <bug-99368-4-0uNwd5UPuw@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-99368-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99368 kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kargl at gcc dot gnu.org Priority|P3 |P4 --- Comment #2 from kargl at gcc dot gnu.org --- % gfc -c z1.f90 2 | type y | 1 ...... 7 | namelist /x/ y | 2 Error: Derived type 'y' at (1) conflicts with namelist object 'y' at (2) diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c index d148de3e3b5..6bde5707926 100644 --- a/gcc/fortran/match.c +++ b/gcc/fortran/match.c @@ -5551,10 +5582,32 @@ gfc_match_namelist (void) gfc_error_check (); } else - /* If the type is not set already, we set it here to the - implicit default type. It is not allowed to set it - later to any other type. */ - gfc_set_default_type (sym, 0, gfc_current_ns); + { + /* Before the symbol is given an implicit type, check to + see if the symbol is already available in the namespace, + possibly through host association. Importantly, the + symbol may be a user defined type. */ + + gfc_symbol *tmp; + + gfc_find_symbol (sym->name, NULL, 1, &tmp); + if (tmp + && tmp->attr.generic + && (tmp = gfc_find_dt_in_generic (tmp))) + { + if (tmp->attr.flavor == FL_DERIVED) + { + gfc_error ("Derived type %qs at %L conflicts with " + "namelist object %qs at %C", + tmp->name, &tmp->declared_at, sym->name); + goto error; + } + } + + /* Set type of the symbol to its implicit default type. It is + not allowed to set it later to any other type. */ + gfc_set_default_type (sym, 0, gfc_current_ns); + } } if (sym->attr.in_namelist == 0 && !gfc_add_in_namelist (&sym->attr, sym->name, NULL))
next prev parent reply other threads:[~2021-08-01 17:04 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-03-03 18:04 [Bug fortran/99368] New: " gscfq@t-online.de 2021-03-03 21:42 ` [Bug fortran/99368] " anlauf at gcc dot gnu.org 2021-08-01 17:04 ` kargl at gcc dot gnu.org [this message] 2023-05-29 21:48 ` kargl at gcc dot gnu.org 2023-05-29 21:58 ` kargl at gcc dot gnu.org 2023-07-08 17:13 ` cvs-commit 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-99368-4-0uNwd5UPuw@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).