From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 547E43858D35; Fri, 16 Jun 2023 21:27:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 547E43858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1686950865; bh=1dVfiXZwSam/7/VIbD5D43KH18SEKZNXu3f0HIVH/CY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ONC4ObJsMa1USR7r+HNC5lkU3FdRStaIq1W8WwPnITkn1//x28r4nNZMfWMDrIpoQ EdEWHADuJkHVPaB6vJ2cCDqyGtJBZU6h53YUn6paRyRl7wyHVYwhLbtesophROc0Fc q3jO9LAugo11IIt44LKrtHR9vmsApGvRInsLb4FM= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/110292] undefined value due to strict aliasing without warning Date: Fri, 16 Jun 2023 21:27:45 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed 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: pinskia at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: WONTFIX 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_status resolution 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=3D110292 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |WONTFIX --- Comment #3 from Andrew Pinski --- So this is IPA modref in action. loads: Base 0: alias set 1 Ref 0: alias set 1 access: Parm 0 param offset:0 offset:0 size:6 max_size:6 stores: Base 0: alias set 0 Ref 0: alias set 0 access: Parm 1 param offset:0 offset:0 size:-1 max_size:64 So we know that e only does a store to the second argument (via aliasing se= t 0 which is the is the root of all aliasing sets) and loads from the first argument with an aliasing set of 1( in this case it is the aliasing set tha= t is contained for struct c). So when DSE comes a long, it removes the store to j as it not used by the e function as it is in the non-conflicting aliasing set of e. Note casting does not change aliasing sets even. In that main could have been: ``` int main(void) { struct c t =3D {0}; uint64_t k; e((uint64_t*)&t, &k); if (k) __builtin_trap(); return 0; } ``` And that would have been valid and well defined code.=