From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E8D263858C36; Wed, 15 Feb 2023 18:22:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E8D263858C36 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1676485324; bh=bl+dpDJHIWeuJM82+h+Z3RU+OZp3HjhcsZE7ej+fxO8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=F4vWtSP5N5NnqCULziLEvViBGXpF0VhX03jifSb4yorRfHT6bLbxxgB4Ds9vVN+Mr rM/k97VbsF/kJhiM/N5J8I80owbNCLPaJGk5yR23r/DnwkGd1xDtqq4KX3j0UT4u1W i/eUccuAkZikw/az0uZlTNOvvfRZMBXGB69nvBos= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/108657] [13 Regression] csmith: possible wrong checksum with -O3 and -ftrivial-auto-var-init=zero Date: Wed, 15 Feb 2023 18:22:03 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: needs-reduction, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org 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: 13.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108657 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #15 from Jakub Jelinek --- Slightly cleaned up; aborts with -O3 -ftrivial-auto-var-init=3Dzero, doesn't abort with -O0, -O3 or -O0 -ftrivial-auto-var-init=3Dzero. int m[256]; unsigned n =3D 4294967295; void foo (int b) { n =3D (n >> 8) ^ m[(n ^ b) & 255]; } void bar (long x) { n =3D (n >> 8) ^ m[(n ^ x) & 255]; foo (x >> 8); foo (x >> 16); foo (x >> 24); foo (x >> 32); foo (x >> 40); foo (x >> 48); foo (x >> 56); } int a =3D -8, c, e, f, g, i; short b; static int *d =3D &c; unsigned h; int main () { if (__CHAR_BIT__ !=3D 8 || __SIZEOF_SHORT__ !=3D 2 || __SIZEOF_INT__ !=3D= 4) return 0; for (; g < 256; g++) { h =3D g; for (i =3D 8; i; i--) if (h & 1) h =3D (h >> 1) ^ 3988292384; else h >>=3D 1; m[g] =3D h; } b =3D 53935 & a; a =3D -18; for (c =3D 1; c >=3D 0; c -=3D 1) { e =3D 0; for (int j =3D 0; j <=3D 3; j++) { short k[1]; if (e) break; e ^=3D f; } } *d =3D 8 || 0; bar (a); bar (b); bar (2185655400); bar (c); if (n !=3D 0xbd51857cU) __builtin_abort (); } The only difference between -O3 and -O3 -ftrivial-auto-var-init=3Dzero in g= imple dump is the addition of k =3D .DEFERRED_INIT (2, 2, &"k"[0]); where k is otherwise unused variable.=