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/113471] [14 regression] wrong array bound check failure on valid code
Date: Thu, 18 Jan 2024 19:44:25 +0000	[thread overview]
Message-ID: <bug-113471-4-nyUL1HIaMy@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-113471-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113471

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|anlauf at gmx dot de               |
           Assignee|unassigned at gcc dot gnu.org      |anlauf at gcc dot gnu.org

--- Comment #2 from anlauf at gcc dot gnu.org ---
The following patch fixes the reduced testcase for me, as well as the
full testcase in comment#0:

diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc
index 26e7adaa03f..3e1a400fa33 100644
--- a/gcc/fortran/trans-array.cc
+++ b/gcc/fortran/trans-array.cc
@@ -3600,7 +3600,9 @@ array_bound_check_elemental (gfc_se * se, gfc_ss * ss,
gfc_expr * expr)
              continue;
            }

-         if (ref->type == REF_ARRAY && ref->u.ar.dimen > 0)
+         if (ref->type == REF_ARRAY
+             && ref->u.ar.type == AR_SECTION
+             && ref->u.ar.dimen > 0)
            {
              ar = &ref->u.ar;
              for (dim = 0; dim < ar->dimen; dim++)

Can you give it a spin?

  parent reply	other threads:[~2024-01-18 19:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-18  9:34 [Bug fortran/113471] New: " juergen.reuter at desy dot de
2024-01-18 10:49 ` [Bug fortran/113471] " rguenth at gcc dot gnu.org
2024-01-18 18:02 ` anlauf at gcc dot gnu.org
2024-01-18 19:44 ` anlauf at gcc dot gnu.org [this message]
2024-01-18 22:12 ` juergen.reuter at desy dot de
2024-01-18 22:19 ` anlauf at gcc dot gnu.org
2024-01-19 20:24 ` cvs-commit at gcc dot gnu.org
2024-01-19 22:14 ` 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-113471-4-nyUL1HIaMy@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).