From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id ACD95385BF9C; Fri, 26 Feb 2021 12:12:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ACD95385BF9C From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/95757] [11 regression] missing warning in gcc.dg/Wstringop-overflow-25.c since r11-1517 Date: Fri, 26 Feb 2021 12:12:09 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: blocked cc priority 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Feb 2021 12:12:11 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95757 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |85316 CC| |amacleod at redhat dot com Priority|P3 |P1 --- Comment #7 from Richard Biener --- So the warning machinery (or likely the range machinery) is confused about size_t r_1_2 =3D UR (1, 2); size_t r_2_3 =3D UR (2, 3); T (char, S (2), r_1_2); // { dg-warning "\\\[-Wstringop-overflow" "pr92814" } T (char, S (0), r_2_3); but it treats the case well when the second T is elided or when the size computation is moved before the Ts like with diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-25.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-25.c index bc609587575..116fbf600a6 100644 --- a/gcc/testsuite/gcc.dg/Wstringop-overflow-25.c +++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-25.c @@ -367,16 +367,16 @@ struct Flex NOIPA void test_strcpy_malloc_flexarray (void) { size_t r_0_1 =3D UR (0, 1); - size_t r_1_2 =3D UR (1, 2); - size_t r_2_3 =3D UR (2, 3); T (char, S (0), r_0_1); T (char, S (1), r_0_1); // { dg-warning "\\\[-Wstringop-overflow" "pr92814" } + size_t r_1_2 =3D UR (1, 2); T (char, S (0), r_1_2); T (char, S (1), r_1_2); T (char, S (2), r_1_2); // { dg-warning "\\\[-Wstringop-overflow" "pr92814" } + size_t r_2_3 =3D UR (2, 3); T (char, S (0), r_2_3); T (char, S (2), r_2_3); T (char, S (3), r_2_3); // { dg-warning "\\\[-Wstringop-overflow" "pr92814" } Martin, is there any harm in changing the testcase this way? The issue reproduces with a cross and the two-line snippet at the top (just prune the rest from the testcase). In case you want to have a closer look why the warning is not issued on ppc64le (where I tested) vs. x86_64. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D85316 [Bug 85316] [meta-bug] VRP range propagation missed cases=