From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E92E938983AE; Thu, 6 Oct 2022 20:41:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E92E938983AE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665088885; bh=YbC6N6ZEc6c60nt06u7w8EZfsX8PqWb93MaEarNy9Ug=; h=From:To:Subject:Date:From; b=FiTOBxXgKLgF8it6sFL+nDX8EJxhMlS0bGj3KTMofD25fkbcgapsBV6jNFdx6o4lH HKfRKADvWmKm/rJhql33lytvOAm+BVgWVRVqwLAgKL1SPqcFs9CI5DclrJL6Ekc0Uu DlZBFZlpDMUjq2rUAIJeyTRuE0gUH4hPMz/BEHTo= From: "shaohua.li at inf dot ethz.ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/107176] New: Wrong code at -O0/-Os on x86_64-pc-linux-gnu Date: Thu, 06 Oct 2022 20:41:25 +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: 13.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=3D107176 Bug ID: 107176 Summary: Wrong code at -O0/-Os on x86_64-pc-linux-gnu Product: gcc Version: 13.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-tk -v Using built-in specs. COLLECT_GCC=3Dgcc-tk COLLECT_LTO_WRAPPER=3D/zdata/shaoli/compilers/ccbuilder-compilers/gcc-b48d7= ff3570fa0ebe7790275cf020d8885120338/libexec/gcc/x86_64-pc-linux-gnu/13.0.0/= lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../configure --disable-multilib --disable-bootstrap --enable-languages=3Dc,c++ --prefix=3D/zdata/shaoli/compilers/ccbuilder-compilers/gcc-b48d7ff3570fa0eb= e7790275cf020d8885120338 Thread model: posix Supported LTO compression algorithms: zlib gcc version 13.0.0 20220928 (experimental) (GCC) % %gcc-tk -O0 a.c && ./a.out 1073741824 % %gcc-tk -Os a.c && ./a.out=20 0 % %cat a.c int a; long b; long c(unsigned d) {=20 return d;=20 } void e(d) {=20 a =3D d;=20 } int main() { b =3D 0; for (; b < 1; b =3D c(b - 90) + 90 + 1) ; e(b >> 2); printf("%d\n", a); } % Compiler explorer: https://godbolt.org/z/zzMdosoKj=