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/109948] [13/14 Regression] ICE(segfault) in gfc_expression_rank() from gfc_op_rank_conformable() Date: Fri, 26 May 2023 21:25:23 +0000 [thread overview] Message-ID: <bug-109948-4-EI4VIcSfe4@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-109948-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109948 --- Comment #12 from anlauf at gcc dot gnu.org --- (In reply to anlauf from comment #11) > I think it does not handle the following variation of the testcase from > the blamed patch: This one seems to be handled by the clumsy attempt: diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc index 75d61a18856..a5dcf07c1ee 100644 --- a/gcc/fortran/resolve.cc +++ b/gcc/fortran/resolve.cc @@ -5622,6 +5625,21 @@ gfc_expression_rank (gfc_expr *e) { if (e->expr_type == EXPR_ARRAY) goto done; + + /* Take rank from associate target. */ + if (e->symtree + && e->symtree->n.sym->as == NULL + && e->symtree->n.sym->assoc + && e->symtree->n.sym->assoc->target + && e->symtree->n.sym->assoc->rankguessed + && e->symtree->n.sym->assoc->target->ref + && e->symtree->n.sym->assoc->target->ref->u.ar.type == AR_FULL + && e->symtree->n.sym->assoc->target->ref->u.ar.as) + { + e->rank = e->symtree->n.sym->assoc->target->ref->u.ar.as->rank; + goto done; + } + /* Constructors can have a rank different from one via RESHAPE(). */ e->rank = ((e->symtree == NULL || e->symtree->n.sym->as == NULL) @@ -5640,7 +5658,7 @@ gfc_expression_rank (gfc_expr *e) if (ref->type != REF_ARRAY) continue; - if (ref->u.ar.type == AR_FULL) + if (ref->u.ar.type == AR_FULL && ref->u.ar.as) { rank = ref->u.ar.as->rank; break; Of course this does not address the point brought up by Mikael.
next prev parent reply other threads:[~2023-05-26 21:25 UTC|newest] Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-05-24 0:20 [Bug fortran/109948] New: " rimvydas.jas at gmail dot com 2023-05-24 17:05 ` [Bug fortran/109948] " rimvydas.jas at gmail dot com 2023-05-24 17:14 ` [Bug fortran/109948] [13/14 Regression] " anlauf at gcc dot gnu.org 2023-05-24 17:19 ` anlauf at gcc dot gnu.org 2023-05-24 18:35 ` anlauf at gcc dot gnu.org 2023-05-25 3:07 ` rimvydas.jas at gmail dot com 2023-05-25 7:36 ` rguenth at gcc dot gnu.org 2023-05-25 18:34 ` anlauf at gcc dot gnu.org 2023-05-25 19:20 ` anlauf at gcc dot gnu.org 2023-05-26 9:47 ` pault at gcc dot gnu.org 2023-05-26 10:15 ` pault at gcc dot gnu.org 2023-05-26 10:34 ` mikael at gcc dot gnu.org 2023-05-26 21:00 ` anlauf at gcc dot gnu.org 2023-05-26 21:25 ` anlauf at gcc dot gnu.org [this message] 2023-05-26 21:35 ` anlauf at gcc dot gnu.org 2023-05-30 8:59 ` pault at gcc dot gnu.org 2023-05-31 17:11 ` pault at gcc dot gnu.org 2023-05-31 18:39 ` anlauf at gcc dot gnu.org 2023-05-31 19:39 ` mikael at gcc dot gnu.org 2023-06-02 7:42 ` cvs-commit at gcc dot gnu.org 2023-06-02 9:13 ` pault at gcc dot gnu.org 2023-06-02 9:16 ` pault at gcc dot gnu.org 2023-08-27 8:51 ` cvs-commit at gcc dot gnu.org 2023-09-07 16:04 ` anlauf at gcc dot gnu.org 2023-09-07 16:06 ` anlauf at gcc dot gnu.org 2023-09-28 8:57 ` 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-109948-4-EI4VIcSfe4@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).