From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6534D3858C54; Fri, 21 Jul 2023 08:04:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6534D3858C54 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689926662; bh=lP4cyOIIFZ07duv1eSsHy0fC3Qcu0Af97R9ZkxfFEAw=; h=From:To:Subject:Date:From; b=dWjAdCu/b6cXayYt4bOZPfczMLFBD6hFPucYfAuyUZZdKzWsB8jZrj4ESuvRWmOwZ JzPPO4PN8NdGNtlXnN5dQxCg7wRnuBrGZNkIlD6wZs/MATdOuagu6/2FQ+ACOSkFOh M4uzoxoybxKbSLgLQM1pB1Ptri0ulUgEV5RQ78/M= From: "jwzeng at nuaa dot edu.cn" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/110761] New: No warning for an uninitialized variable when used within its own initialization Date: Fri, 21 Jul 2023 08:04:22 +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: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jwzeng at nuaa dot edu.cn 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=3D110761 Bug ID: 110761 Summary: No warning for an uninitialized variable when used within its own initialization Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: jwzeng at nuaa dot edu.cn Target Milestone: --- Link to the Compiler Explorer: https://godbolt.org/z/ra7P3EcMn There is no warning for a variable is uninitialized when used within its own initialization. $ cat test.c int main(void)=20 { int a =3D 1, b =3D 2; int g =3D (a % ((~0) && b)) && g; } $ gcc-trunk -Wall -Wextra -pedantic -c test.c $ $ clang-16.0.0 -Weverything -pedantic -c test.c test.c:4:34: warning: variable 'g' is uninitialized when used within its own initialization [-Wuninitialized] int g =3D (a % ((~0) && b)) && g; ~ ^ 1 warning generated. $ $ gcc-trunk -v gcc (GCC) 14.0.0 20230619 (experimental) [master r14-1917-gf8e0270272] $ clang-16.0.0 -v clang version 16.0.0 Target: x86_64-unknown-linux-gnu Would it be better to output warning information like clang? In gcc-11.4 and earlier versions, there will be corresponding warnings.=