From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id AC7173858416; Wed, 12 Jan 2022 07:08:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AC7173858416 From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/103986] [9/10 Regression] Miscompilation with -O2 -funswitch-loops and __builtin_unreachable Date: Wed, 12 Jan 2022 07:08:04 +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: 10.3.1 X-Bugzilla-Keywords: needs-bisection, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 9.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cf_reconfirmed_on bug_status everconfirmed 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, 12 Jan 2022 07:08:04 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103986 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2022-01-12 Status|UNCONFIRMED |NEW Ever confirmed|0 |1 --- Comment #7 from Andrew Pinski --- Those come from dom3. Here is a testcase which runs in finite time to test this (plus it is not a= C testcase also): #define assume(Expression) do { if((Expression)) (void)0; else __builtin_unreachable(); } while(0) struct GridZYXIterator {=20=20=20=20=20=20=20=20 short x; short y; short z; }; static inline void f(struct GridZYXIterator *t) { t->x++; if(t->x =3D=3D 3) { t->x =3D 0; t->y++; if(t->y =3D=3D 3) { t->y =3D 0; t->z++; } } } static int t =3D 0; static void g() __attribute__((noipa)); static void g(){t++; if (t > 27) __builtin_abort();}; int main() { struct GridZYXIterator it =3D {0,0,0}; while(it.z !=3D 3) { assume(it.y < 3 && it.z < 3); g(); f(&it); }=20=20=20=20=20=20=20 } Confirmed.=