From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 314B33858C39; Wed, 6 Oct 2021 21:40:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 314B33858C39 From: "msebor at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/102633] New: warning for self-initialization despite -Wno-init-self Date: Wed, 06 Oct 2021 21:40:45 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: msebor 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 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: Wed, 06 Oct 2021 21:40:45 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102633 Bug ID: 102633 Summary: warning for self-initialization despite -Wno-init-self Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: msebor at gcc dot gnu.org Target Milestone: --- GCC issues -Wuninitialized for cv-qualified variables initialized with themselves even when -Wno-init-self is in effect. $ cat x.c && gcc -O2 -S -Wall -Wno-init-self -xc++ x.c int f (void) { int i =3D i; // no warning (good) return i; } int g (void) { const int i =3D i; // -Wuninitialized (bug) return i; } int h (void) { volatile int i =3D i; // -Wuninitialized (bug) return i; } x.c: In function =E2=80=98int g()=E2=80=99: x.c:9:13: warning: =E2=80=98i=E2=80=99 is used uninitialized [-Wuninitializ= ed] 9 | const int i =3D i; // -Wuninitialized (bug) | ^ x.c:9:13: note: =E2=80=98i=E2=80=99 was declared here 9 | const int i =3D i; // -Wuninitialized (bug) | ^ x.c: In function =E2=80=98int h()=E2=80=99: x.c:15:20: warning: =E2=80=98i=E2=80=99 is used uninitialized [-Wuninitiali= zed] 15 | volatile int i =3D i; // -Wuninitialized (bug) | ^ x.c:15:16: note: =E2=80=98i=E2=80=99 declared here 15 | volatile int i =3D i; // -Wuninitialized (bug) | ^=