From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id F3AB43858C55; Tue, 1 Nov 2022 11:49:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F3AB43858C55 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667303354; bh=R9IKvMbznCZc0y6VhHQXvH3zelQ8tca+brXovWgR0yo=; h=From:To:Subject:Date:From; b=maOxC9OOPP/7PS4bpPhFtDtQwIsk6m6n7eFHQLrxzyBXe2Zh6Fj23JgLZkgSUFWtd xErE0Q0RjmrcdHvGoL2aEiaQASTZugk5lsnDL776moKpbOAu/mqcpNVYZPQsL3+EOG iYLvxoQOxE9Kt1Gh5KVmJ3nFCk/Y4DRfAhQOuXE8= From: "shaohua.li at inf dot ethz.ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/107493] New: Wrong code at -Os on x86_64-linux-gnu Date: Tue, 01 Nov 2022 11:49:13 +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=3D107493 Bug ID: 107493 Summary: Wrong code at -Os on x86_64-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-db55f= 1dda2692c3f778ae783bc7121891c79aec4/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-db55f1dda2692c3f= 778ae783bc7121891c79aec4 Thread model: posix Supported LTO compression algorithms: zlib gcc version 13.0.0 20221031 (experimental) (GCC)=20 %=20 % gcc-tk -O0 a.c && ./a.out 65525 % gcc-tk -Os a.c && ./a.out 65515 % % cat a.c int printf(const char *format, ...); int a; int b(int c) {=20 return c;=20 } int main() { a =3D -21; for (; a <=3D 0; a =3D (unsigned short)(b(a + 2) + 8)) ; printf("%d\n", a); } % Compiler explorer: https://godbolt.org/z/hhqrv7hWh=