From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 68097383D800; Thu, 12 May 2022 16:58:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 68097383D800 From: "ed at catmur dot uk" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/105585] New: [12/13 Regression] Spurious stringop-overflow warning with Date: Thu, 12 May 2022 16:58:07 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 12.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ed at catmur dot uk X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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: Thu, 12 May 2022 16:58:07 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105585 Bug ID: 105585 Summary: [12/13 Regression] Spurious stringop-overflow warning with Product: gcc Version: 12.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: ed at catmur dot uk Target Milestone: --- Reduced (from code in abseil-cpp): #include struct S { int i; std::atomic a; }; S* q(); void f(); void g(bool b) { auto p =3D b ? q() : nullptr; ++p->a; if (p) f(); } In file included from atomic:41, from :1: In member function 'std::__atomic_base<_IntTp>::__int_type std::__atomic_base<_IntTp>::operator++() [with _ITp =3D int]', inlined from 'void g(bool)' at :10:3: bits/atomic_base.h:385:34: warning: 'unsigned int __atomic_add_fetch_4(vola= tile void*, unsigned int, int)' writing 4 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=3D] 385 | { return __atomic_add_fetch(&_M_i, 1, int(memory_order_seq_cs= t)); } | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~=