From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C09053858D32; Mon, 1 Apr 2024 20:36:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C09053858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1712003769; bh=LHFno/Z9dVJDXDC7F/vksF36dZDw++JUG/FBFx7emQk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=VIg9mmvklUhKEl5DWsU+SWgL/pmuyX3Z3ey1aage0HDI+btiKRBvOWj/YBSZHWAAu svKGNKe7IXnl87RBajCI4c3wwN92CtIU0IJOyByxh+Ssr8HTpsCVmnC/vkzwOOdYGZ 4ZiC4G0XAzEdmbyN+CFfhCDqbZIthH/hxClNwMa8= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/114552] [13/14 Regression] wrong code at -O1 and above on x86_64-linux-gnu Date: Mon, 01 Apr 2024 20:36:09 +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: unknown X-Bugzilla-Keywords: needs-bisection, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: target_milestone cf_reconfirmed_on short_desc component bug_status cf_gcctarget keywords everconfirmed 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=3D114552 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |13.3 Last reconfirmed| |2024-04-01 Summary|wrong code at -O1 and above |[13/14 Regression] wrong |on x86_64-linux-gnu |code at -O1 and above on | |x86_64-linux-gnu Component|tree-optimization |middle-end Status|UNCONFIRMED |NEW Target| |x86_64-linux-gnu Keywords| |needs-bisection, wrong-code Ever confirmed|0 |1 --- Comment #2 from Andrew Pinski --- Better reduced testcase, removing the pragma and putting the packed on the struct that is causing the issue: ``` struct a { short b; int c; }__attribute__((packed)); struct d { struct a b; int e; }; static const struct d k =3D {{1,0},0}; [[gnu::noinline]] void p() { asm("":::"memory"); } [[gnu::noinline]] void q(struct a n) { p(); } int main() { q(k.b); return 0; } ``` The bug is in the middle-end expanding the call `q(k.b);` such that k.b is = on the stack but it messes up and uses the wrong size or something.=