From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id AFCB83858412; Wed, 24 Nov 2021 07:09:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AFCB83858412 From: "zhendong.su at inf dot ethz.ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/103376] [12 Regression] wrong code at -Os and above on x86_64-linux-gnu since r12-5453-ga944b5dec3adb28e Date: Wed, 24 Nov 2021 07:09:17 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: zhendong.su at inf dot ethz.ch X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: jakub at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Nov 2021 07:09:17 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103376 --- Comment #7 from Zhendong Su --- A couple of additional tests for the same issue: (1) at -Os and above [622] % gcctk -O1 small.c; ./a.out [623] % gcctk -Os small.c; ./a.out Aborted [624] % cat small.c long a =3D 2653121401; unsigned char b; int c; int main() { b =3D a; c =3D ~(((a ^ b) + 2) ^ 254); if (c > 1641845765) __builtin_abort(); return 0; } (2) at -O2 and -O3 [511] % gcctk -Os small.c; ./a.out [512] % gcctk -O2 small.c; ./a.out Segmentation fault [513] %=20 [513] % cat small.c int printf(const char *, ...); int a =3D 1, *b; int main() { int c =3D a; if (a =3D=3D 2) printf("0"); a =3D a ^ c; if (a) a++; if (a && *b) return a; return 0; }=