From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 183143858D37; Thu, 18 Jan 2024 22:12:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 183143858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705615951; bh=D8+pBOa0E33u6h3DMW+cpdb/bdTT/mHcK9zUhaNrI90=; h=From:To:Subject:Date:In-Reply-To:References:From; b=agklQCuqcnuuHIiUS4vHL5lV1EAWm9bk3L2EKBbu5yN2Tsyh3EAC28m24CC7Vl/hT x6IdJ4VYR/yzaKU3siO0hPQOdpaMItVXWnqNvBGXPbIfXl+QBsoAZA1OBXc2kUZyFk +gz3e55Zr6lrEOyhnLYvc0CSl0NPl/Afk5xHKHd8= From: "juergen.reuter at desy dot de" 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 22:12:30 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: juergen.reuter at desy dot de X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P4 X-Bugzilla-Assigned-To: anlauf at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113471 --- Comment #3 from J=C3=BCrgen Reuter --- (In reply to anlauf from comment #2) > The following patch fixes the reduced testcase for me, as well as the > full testcase in comment#0: >=20 > 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; > } >=20=20 > - if (ref->type =3D=3D REF_ARRAY && ref->u.ar.dimen > 0) > + if (ref->type =3D=3D REF_ARRAY > + && ref->u.ar.type =3D=3D AR_SECTION > + && ref->u.ar.dimen > 0) > { > ar =3D &ref->u.ar; > for (dim =3D 0; dim < ar->dimen; dim++) >=20 > Can you give it a spin? Thanks for the quick reaction, indeed with your fix, all our tests do work again when all check flags are switched on (we don't do it in our CI with gfortran, but with only with nagfor, so I just noticed it now).=