From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 76A543858D3C; Mon, 28 Aug 2023 07:13:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 76A543858D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1693206804; bh=seWoHPSYhl2nhZvCiN7JYawskl7960xYuVbaY6K0+MM=; h=From:To:Subject:Date:From; b=uY1YlX5pBxkVn/aVnRYOIi/s8WYV8zqmuI+2O9qiyS61BgUJPyxv2iHt2OXyckqGG FoiIKh2piwY8eDibRojJO/2q2fFHLHXT3s62zo81UHbOoxmIDfRb6AJTWHPPfGfuXB 3GPooFUWdTyNnDjjeMaNesDET16LJki+Q4q9ua7E= From: "shaohua.li at inf dot ethz.ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/111210] New: Wrong code at -Os on x86_64-linux-gnu since r12-4849-gf19791565d7 Date: Mon, 28 Aug 2023 07:13:24 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: shaohua.li at inf dot ethz.ch 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=3D111210 Bug ID: 111210 Summary: Wrong code at -Os on x86_64-linux-gnu since r12-4849-gf19791565d7 Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: shaohua.li at inf dot ethz.ch Target Milestone: --- gcc at -Os produces the wrong code. Bisected to r12-4849-gf19791565d7 Compiler explorer: https://godbolt.org/z/fjcEvKdYT $ cat a.c int printf(const char *, ...); int a; int *b =3D &a; int c(long *d) { if (*d) return *(int *)0; return *(int *)(d + 1); } int main() { long e[] =3D {0, 100}; int f =3D c(e); *b =3D f; printf("%d\n", a); } $ $ gcc -O3 a.c && ./a.out 100 $ gcc -Os a.c && ./a.out 0 $=