From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7B6773857803; Wed, 30 Nov 2022 16:01:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7B6773857803 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669824089; bh=0MEtsU0o60edfM/nPafoLenteRxu93eaHss+1YKRDmo=; h=From:To:Subject:Date:From; b=mTSYKQ2oeg1pfy4+wbXsWZQD1OaJ3JLONtgJtPN/e2NcEe1d/p/Jikr0IUYfuDwaO 7L/cFaHuCjDwTddOg/AqYakzuxCUxODv8IbwYmvXt4sdWq4ckjuzZG6ZwaI9E38saw t3E1n1trZxGsy2L6Z43lGKd7j4ZieoE6GtHlpH1o= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug lto/107936] New: #pragma GCC diagnostic ignored vs. LTO Date: Wed, 30 Nov 2022 16:01:29 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: lto X-Bugzilla-Version: 12.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org 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 cc 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=3D107936 Bug ID: 107936 Summary: #pragma GCC diagnostic ignored vs. LTO Product: gcc Version: 12.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto Assignee: unassigned at gcc dot gnu.org Reporter: jakub at gcc dot gnu.org CC: marxin at gcc dot gnu.org Target Milestone: --- rh1948567-1.c: void foo (char x[2]); int main () { char x[2]; #pragma GCC diagnostic ignored "-Wstringop-overflow" foo (x + 1); } rh1948567-2.c: void foo (char x[2]) { asm volatile ("" : : "r" (&x[0]) : "memory"); } gcc -W -Wall -flto -o rh1948567{,-1.c,-2.c} rh1948567-1.c: In function =E2=80=98main=E2=80=99: rh1948567-1.c:8:3: warning: =E2=80=98foo=E2=80=99 accessing 2 bytes in a re= gion of size 1 [-Wstringop-overflow=3D] 8 | foo (x + 1); | ^ rh1948567-1.c:8:3: note: referencing argument 1 of type =E2=80=98char[2]=E2= =80=99 rh1948567-2.c:2:1: note: in a call to function =E2=80=98foo=E2=80=99 2 | foo (char x[2]) | ^ Shouldn't the diagnostic pragma prevent the warning even in the LTO case?=