From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 04D863858D3C; Mon, 17 Oct 2022 08:00:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 04D863858D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665993645; bh=SuLm008+nZeVE5vNMBiSxfmvrYJoRJboVmg7q7maXNY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=qGn1XzcdtYjUCUAoTojp2PoDhyc675MbKFWbMUhJX5rS2noCYhJBP61z9A2qxsEOb yWG8K7wlJC/+n92oKWlxUPt9Ym+D/Oe449twX080qqt5mLXPJnKVe/ycudTFujVPBJ xJUK4Y53TANeJaNfB2Xcr/vpeGI8HPTv0fC9Nk48= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/107274] Incorrect -Wuninitialized on indexed initialization Date: Mon, 17 Oct 2022 08:00:44 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 12.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: INVALID 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: blocked resolution bug_status Message-ID: In-Reply-To: References: 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=3D107274 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |24639 Resolution|--- |INVALID Status|UNCONFIRMED |RESOLVED --- Comment #2 from Richard Biener --- No, the issue is that you are accessing 8 bytes on the read and thus the padding you access that way is not initialized. Use *(unsigned int)b and t= he diagnostic goes away. [internally GCC doesn't consider an indirect load of size 8 ever aliasing a store to a 4 byte object - otherwise we wouldn't diagnose a partial uninit value -- like void example(unsigned long val) { char b[8]; b[0] =3D val; b[1] =3D val >> 8; b[2] =3D val >> 16; b[3] =3D val >> 24; val =3D *(unsigned long *)b; } which isn't diagnosed] Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D24639 [Bug 24639] [meta-bug] bug to track all Wuninitialized issues=