public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "pault at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/93956] Wrong array creation with p => array_dt(1:n)%component Date: Tue, 28 Apr 2020 16:23:06 +0000 [thread overview] Message-ID: <bug-93956-4-781vwlZj0I@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-93956-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93956 --- Comment #16 from Paul Thomas <pault at gcc dot gnu.org> --- Hi Thomas, I am sorry that you are having such a hassle with this - perhaps this helps? > > I assume that the span is not used correctly in the > function. Yes, that is correct. Within 'foo', we have a.0 = (integer(kind=4)[0:D.3967] * restrict) a->data; and the sum is inlined as: while (1) { if (S.10 > D.3961) goto L.1; val.9 = (*a.0)[S.10 * D.3963 + D.3960] + val.9; S.10 = S.10 + 1; } L.1:; so that the sum becomes: sum(r(1:500)%u) + sum(r(1:500)%v). This fixes the problem at the expense of more temporaries but regtests fine: diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index a9fa03ad153..8ca2b9bb3cb 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -1098,10 +1098,14 @@ is_subref_array (gfc_expr * e) bool seen_array; gfc_symbol *sym; - if (e->expr_type != EXPR_VARIABLE) - return false; - sym = e->symtree->n.sym; + if (e->expr_type == EXPR_VARIABLE) + sym = e->symtree->n.sym; + else if (e->expr_type == EXPR_FUNCTION + && gfc_expr_attr (e).subref_array_pointer) + return true; + else + return false; if (sym->attr.subref_array_pointer) return true; @@ -4242,7 +4246,7 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr *rvalue, if (rvalue->expr_type == EXPR_NULL) return true; - if (rvalue->expr_type == EXPR_VARIABLE && is_subref_array (rvalue)) + if (is_subref_array (rvalue)) lvalue->symtree->n.sym->attr.subref_array_pointer = 1; attr = gfc_expr_attr (rvalue); Paul
next prev parent reply other threads:[~2020-04-28 16:23 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-93956-4@http.gcc.gnu.org/bugzilla/> 2020-03-11 12:04 ` marxin at gcc dot gnu.org 2020-04-14 17:16 ` tkoenig at gcc dot gnu.org 2020-04-20 5:26 ` mscfd at gmx dot net 2020-04-20 14:36 ` tkoenig at gcc dot gnu.org 2020-04-20 16:08 ` tkoenig at gcc dot gnu.org 2020-04-20 18:42 ` tkoenig at gcc dot gnu.org 2020-04-21 18:48 ` tkoenig at gcc dot gnu.org 2020-04-23 18:31 ` cvs-commit at gcc dot gnu.org 2020-04-24 6:23 ` cvs-commit at gcc dot gnu.org 2020-04-24 7:27 ` cvs-commit at gcc dot gnu.org 2020-04-24 7:28 ` tkoenig at gcc dot gnu.org 2020-04-24 7:28 ` tkoenig at gcc dot gnu.org 2020-04-26 12:52 ` cvs-commit at gcc dot gnu.org 2020-04-27 21:51 ` cvs-commit at gcc dot gnu.org 2020-04-27 21:53 ` tkoenig at gcc dot gnu.org 2020-04-28 16:23 ` pault at gcc dot gnu.org [this message] 2020-05-01 12:53 ` cvs-commit at gcc dot gnu.org 2020-05-01 12:55 ` cvs-commit at gcc dot gnu.org 2020-05-21 10:42 ` tkoenig at gcc dot gnu.org 2021-04-16 16:22 ` tkoenig 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-93956-4-781vwlZj0I@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).