From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 649E13858C74; Thu, 8 Jun 2023 14:44:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 649E13858C74 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1686235459; bh=4AXm5QZZ6aaTJHAxNsy9k8BhFwg6UOwFjmdxQbBvDnQ=; h=From:To:Subject:Date:From; b=mgI3YzmcZ0pGnHDiT5w7nGuxWRS+nn5IWT424lVvzR/y0BVX4DIGBV7VbFZ49K8us 6CtmsruWzfa0K50e6SryAVWY+DlrUkU6y3UFKWjSzKbn2lM9es2ykv/TjfabRyEqNy 2BpldFflGFaRTSmDIdqx0M0U+GwLx7mqxl2j4ZmA= From: "zhendong.su at inf dot ethz.ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/110176] New: wrong code at -Os and above on x86_64-linux-gnu Date: Thu, 08 Jun 2023 14:44:19 +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=3D110176 Bug ID: 110176 Summary: wrong code at -Os 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 seems to affect GCC 10.4 and later. Compiler Explorer: https://godbolt.org/z/aKfvfxa63 [504] % gcctk -v Using built-in specs. COLLECT_GCC=3Dgcctk COLLECT_LTO_WRAPPER=3D/local/home/suz/suz-local/software/local/gcc-trunk/bi= n/../libexec/gcc/x86_64-pc-linux-gnu/14.0.0/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 --disable-multilib Thread model: posix Supported LTO compression algorithms: zlib gcc version 14.0.0 20230607 (experimental) (GCC)=20 [505] %=20 [505] % gcctk -O1 small.c; ./a.out [506] %=20 [506] % gcctk -O2 small.c [507] % timeout -s 9 5 ./a.out Killed [508] %=20 [508] % cat small.c int a, b; void c() {} int d() { unsigned f[1]; int i; if (a) goto h; f[0] =3D -1; while (1) { c(); for (; a < 1; a++) { if (0) { j: continue; } i =3D f[0]; if (a) break; b =3D i >=3D (b =3D=3D 0); } if (!b) { if (0) { h: goto j; } return 0; } } } int main() { d(); return 0; }=