public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "markeggleston at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/53298] ICE in gfc_conv_scalarized_array_ref for ARRAY + substring Date: Wed, 09 Sep 2020 06:57:33 +0000 [thread overview] Message-ID: <bug-53298-4-c8QtqX4sTF@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-53298-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53298 --- Comment #14 from markeggleston at gcc dot gnu.org --- The test case in comment 7 proved trickier to track down. The ICE occurs in this code: /* Components can correspond to fields of different containing types, as components are created without context, whereas a concrete use of a component has the type of decl as context. So, if the type doesn't match, we search the corresponding FIELD_DECL in the parent type. To not waste too much time we cache this result in norestrict_decl. On the other hand, if the context is a UNION or a MAP (a RECORD_TYPE within a UNION_TYPE) always use the given FIELD_DECL. */ if (context != TREE_TYPE (decl) && !( TREE_CODE (TREE_TYPE (field)) == UNION_TYPE /* Field is union */ || TREE_CODE (context) == UNION_TYPE)) /* Field is map */ { tree f2 = c->norestrict_decl; if (!f2 || DECL_FIELD_CONTEXT (f2) != TREE_TYPE (decl)) ==> for (f2 = TYPE_FIELDS (TREE_TYPE (decl)); f2; f2 = DECL_CHAIN (f2)) if (TREE_CODE (f2) == FIELD_DECL && DECL_NAME (f2) == DECL_NAME (field)) break; gcc_assert (f2); c->norestrict_decl = f2; field = f2; } The ICE occurs at the line marked with ==>, the assignment f2 = TYPE_FIELDS (TREE_TYPE (decl)) hides a call to a routine that returns a null pointer which is then used causing the ICE. I speculated that the code dealing with f2 should not have been executed. I noted that in the comments "On the other hand, if the context is a UNION or a MAP (a RECORD_TYPE within a UNION_TYPE) always use the given FIELD_DECL." This does not match the code that follows. The following change: trans-expr.c @@ -2474,8 +2474,8 @@ gfc_conv_component_ref (gfc_se * se, gfc_ref * ref) RECORD_TYPE within a UNION_TYPE) always use the given FIELD_DECL. */ if (context != TREE_TYPE (decl) - && !( TREE_CODE (TREE_TYPE (field)) == UNION_TYPE /* Field is union */ - || TREE_CODE (context) == UNION_TYPE)) /* Field is map */ + && ( TREE_CODE (context) == UNION_TYPE /* Field is union */ + || TREE_CODE (context) == MAP_TYPE)) /* Field is map */ { tree f2 = c->norestrict_decl; if (!f2 || DECL_FIELD_CONTEXT (f2) != TREE_TYPE (decl)) matches the comment and also fixes the ICE for the test case in comment 7. make -j 8 check-fortran was looking good until test case failures were reported for: gfortran.dg/finalize_35.f90 gfortran.dg/finalize_36.f90
prev parent reply other threads:[~2020-09-09 6:57 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-05-09 17:12 [Bug fortran/53298] New: " burnus at gcc dot gnu.org 2013-04-06 11:46 ` [Bug fortran/53298] " tkoenig at gcc dot gnu.org 2013-04-27 13:31 ` dominiq at lps dot ens.fr 2020-07-23 8:36 ` bardeau at iram dot fr 2020-07-23 8:38 ` bardeau at iram dot fr 2020-07-29 10:16 ` cvs-commit at gcc dot gnu.org 2020-07-29 10:17 ` markeggleston at gcc dot gnu.org 2020-07-29 14:32 ` dominiq at lps dot ens.fr 2020-07-30 9:22 ` markeggleston at gcc dot gnu.org 2020-09-09 6:34 ` markeggleston at gcc dot gnu.org 2020-09-09 6:57 ` markeggleston at gcc dot gnu.org [this message]
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-53298-4-c8QtqX4sTF@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).