From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B5BFB385780B; Sun, 29 Nov 2020 22:38:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B5BFB385780B From: "msebor at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/89428] missing -Wstringop-overflow on a PHI with variable offset Date: Sun, 29 Nov 2020 22:38:52 +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: 9.0 X-Bugzilla-Keywords: diagnostic, patch X-Bugzilla-Severity: normal X-Bugzilla-Who: msebor at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: msebor at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status resolution target_milestone 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: Sun, 29 Nov 2020 22:38:52 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D89428 Martin Sebor changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution|--- |FIXED Target Milestone|--- |11.0 --- Comment #6 from Martin Sebor --- Resolved by r11-5523 for GCC 11 which now issues the following warnings for the test case in comment #0 (the duplicate note needs to be fixed): $ gcc -O2 -S pr89428.c pr89428.c: In function =E2=80=98f=E2=80=99: pr89428.c:7:3: warning: =E2=80=98__builtin_memset=E2=80=99 writing 7 bytes = into a region of size 6 overflows the destination [-Wstringop-overflow=3D] 7 | __builtin_memset (a + i, 0, 7); // warning (good) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ pr89428.c:1:6: note: at offset [1, 2] into destination object =E2=80=98a=E2= =80=99 of size 7 1 | char a[7]; | ^ pr89428.c: In function =E2=80=98g=E2=80=99: pr89428.c:14:3: warning: =E2=80=98__builtin_memset=E2=80=99 writing 99 byte= s into a region of size 7 overflows the destination [-Wstringop-overflow=3D] 14 | __builtin_memset (a + i, 0, 99); // missing warning (bug) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ pr89428.c:1:6: note: destination object =E2=80=98a=E2=80=99 of size 7 1 | char a[7]; | ^ pr89428.c:1:6: note: destination object =E2=80=98a=E2=80=99 of size 7=