From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5267B3858D28; Mon, 1 Apr 2024 19:34:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5267B3858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1712000087; bh=bniHBJUo2J5/4xk1KvzAKTeVM88GKsgbQOhw44nFT5E=; h=From:To:Subject:Date:From; b=nviROYBp0yytMgk8n/13kYhgQ6yXBHA+m0EgPNqiqP9lsSz0qrF5brguPqauyp+Te acGyMnACqPteS1YNP/Smt8nAhPVL2kjFRlpoDx40ENRLLnmTWIhfBIKMR8ibIPyxDo GQeOUPaOln7+0MZ3l5aBHCSP6KM5iQbmD3QMgHZ4= From: "zhendong.su at inf dot ethz.ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/114552] New: wrong code at -O1 and above on x86_64-linux-gnu Date: Mon, 01 Apr 2024 19:34:46 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: zhendong.su 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=3D114552 Bug ID: 114552 Summary: wrong code at -O1 and above on x86_64-linux-gnu Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: zhendong.su at inf dot ethz.ch Target Milestone: --- It is a regression from 12.3, and affects 13.* and the trunk.=20 Compiler Explorer: https://godbolt.org/z/bznEs9bao [656] % gcctk -v Using built-in specs. COLLECT_GCC=3Dgcctk COLLECT_LTO_WRAPPER=3D/local/suz-local/software/local/gcc-trunk/libexec/gcc= /x86_64-pc-linux-gnu/14.0.1/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc-trunk/configure --disable-bootstrap --enable-checking=3Dyes --prefix=3D/local/suz-local/software/local/gcc-trunk --enable-sanitizers --enable-languages=3Dc,c++ --disable-werror --enable-mu= ltilib Thread model: posix Supported LTO compression algorithms: zlib gcc version 14.0.1 20240401 (experimental) (GCC)=20 [657] %=20 [657] % gcctk -O0 small.c; ./a.out [658] %=20 [658] % gcctk -O1 small.c [659] % ./a.out Segmentation fault [660] %=20 [660] % cat small.c #pragma pack(1) struct a { short b; int c; }; struct d { struct a b; int e; }; short f, g, h; int i, j, o; const struct d k =3D {{1,0},0}; short *l =3D &h, *m =3D &g, *n =3D &f; void p() { *n =3D (o > 0) > o; } void q(struct a n) { j =3D 0; for (; j < 5; j++) i =3D *m =3D *l !=3D 0; p(); } int main() { q(k.b); return 0; }=