From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 028413833010; Wed, 12 May 2021 12:27:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 028413833010 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/100566] New: [11/12 Regression] Miscompilation of mausezahn since r11-2446 Date: Wed, 12 May 2021 12:27:27 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 11.1.0 X-Bugzilla-Keywords: 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: --- 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 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 May 2021 12:27:28 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100566 Bug ID: 100566 Summary: [11/12 Regression] Miscompilation of mausezahn since r11-2446 Product: gcc Version: 11.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: jakub at gcc dot gnu.org Target Milestone: --- The following testcase is miscompiled at -O2 since r11-2446-g3e61a2056335ca7d4e2009823efae4ee2dc950ee - it loops endlessly instead of terminating. struct S { unsigned int s1, s2; int s3, s4, s5, s6, s7; unsigned int s8; }; struct S s; enum E { E1, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11, E12, E13, E14, E15 }; enum E e; int f, g, h; __attribute__((noipa)) void fn1 (void *l) { asm volatile ("" : : "r" (l) : "memory"); } __attribute__((noipa)) int fn2 (void *l) { asm volatile ("" : : "r" (l) : "memory"); return 0; } __attribute__((noipa)) int fn3 (void) { asm volatile ("" : : : "memory"); return 0; } __attribute__((nothrow, leaf, noipa)) int fn4 (void) { asm volatile ("" : : : "memory"); return 0; } __attribute__((noipa)) int fn5 (unsigned int l) { asm volatile ("" : : "r" (l) : "memory"); return 0; } __attribute__((noipa)) int fn6 (void *l, int t) { asm volatile ("" : : "r" (l), "r" (t) : "memory"); return 0; } __attribute__((noipa)) int fn7 (void *l, int t) { asm volatile ("" : : "r" (l), "r" (t) : "memory"); return 0; } __attribute__((noipa)) int fn8 (void *l, int t) { asm volatile ("" : : "r" (l), "r" (t) : "memory"); return 0; } __attribute__((noipa)) int fn9 (void *l, int t) { asm volatile ("" : : "r" (l), "r" (t) : "memory"); return 0; } __attribute__((noipa)) int fn10 (void *l, int t) { asm volatile ("" : : "r" (l), "r" (t) : "memory"); return 0; } __attribute__((noipa)) int fn11 (void *l, int t) { asm volatile ("" : : "r" (l), "r" (t) : "memory"); return 0; } __attribute__((noipa)) int fn12 (void *l, int t) { asm volatile ("" : : "r" (l), "r" (t) : "memory"); return 0; } __attribute__((noipa)) int fn13 (void *l, int t) { asm volatile ("" : : "r" (l), "r" (t) : "memory"); return 0; } __attribute__((noipa)) int fn14 (void *l, int t) { asm volatile ("" : : "r" (l), "r" (t) : "memory"); return 0; } __attribute__((noipa)) int test (void *l, int y, int z) { int i =3D 0, s1; int s8, s7, s6, s5, s4, j =3D 0; s1 =3D s.s1; s8 =3D s.s8; s7 =3D s.s7; s6 =3D s.s6; s5 =3D s.s5; s4 =3D s.s4 | s.s3; if (e =3D=3D E11) j =3D 1; if (s1 =3D=3D 0) goto lab; for (i =3D 0; i < s1; i++) { lab: if (f) { switch (e) { case E6: fn12 (l, z); break; case E7: case E9: case E11: case E13: fn13 (l, z); break; case E8: fn14 (l, z); break; } } if (g) fn3 (); fn2 (l); if (h) s.s2 =3D (unsigned int) s.s2 * fn4 () / 2147483647; if (s.s2) fn5 (s.s2); if (s8) { if (fn11 (l, z) =3D=3D 0) goto lab; } if (s7) { if (fn9 (l, z) =3D=3D 0) goto lab; } if (s6) { if (fn10 (l, z) =3D=3D 0) goto lab; } if (s5) { if (fn8 (l, y) =3D=3D 0) goto lab; } if (s4) { if (fn7 (l, y) =3D=3D 0) goto lab; } if (j) fn6 (l, z); if (!s1) goto lab; } fn1 (l); return 0; } int main () { asm volatile ("" : : "g" (&s), "g" (&e), "g" (&f), "g" (&g), "g" (&h) : "memory"); s.s1 =3D 1; e =3D E7; test (0, 2, 1); return 0; }=