From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B9C773845159; Tue, 28 Nov 2023 16:15:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B9C773845159 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1701188102; bh=BTg1Q8Q353gP3HQ9dwpzaF9HquZsHpVnrQRQU/FHuWs=; h=From:To:Subject:Date:From; b=DqFF9NH0YlkWBsQ5nbH7KboU0TaaMavWCz3rLTy13qGO9e9ykGmE7c92I7sTZs6ZP e7qOxuYCMGPslyoT0lmnIbcNDa589iwrCpYj6+xvL2M0BYYBeKyU/nK4sLc9cClGfY tvq0q/u1cHA5CcANEjI2RIQnZUx7C+vxoH4m3cU8= From: "piannetta at kalrayinc dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug pch/112747] New: #pragma GCC diagnostic ignored "-Wstringop-overflow" has no effect in pre-compiled headers. Date: Tue, 28 Nov 2023 16:15:02 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: pch X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: piannetta at kalrayinc dot com 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D112747 Bug ID: 112747 Summary: #pragma GCC diagnostic ignored "-Wstringop-overflow" has no effect in pre-compiled headers. Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: pch Assignee: unassigned at gcc dot gnu.org Reporter: piannetta at kalrayinc dot com Target Milestone: --- =3D=3D> t.c <=3D=3D #include "t.h" extern char a[10]; int g () { return f(a, 11, 1); } =3D=3D> t.h <=3D=3D #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wstringop-overflow" static char f (char *a, int idx, char v) { return a[idx] =3D v; } #pragma GCC diagnostic pop =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D $ gcc t.c -O2 -c $ gcc t.h -O2 $ gcc t.c -O2 In function 'f', inlined from 'g' at t.c:8:10: t.h:3:58: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=3D] t.c: In function 'g': t.c:4:13: note: at offset 11 into destination object 'a' of size 10 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D -Wstringop-overflow is not ignored as it ought to be when a pre-compiled he= ader exists. This cause the test gcc/libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/minimal.cc from libstdc++v3 to fail. I can reproduce the bug on gcc12, gcc13, gcc14 and trunk.=