[Bug tree-optimization/125501] [14/15/16/17 Regression] wrong code at -O3 that crashes at runtime
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jun 2 16:06:46 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125501
--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Andrew Macleod from comment #9)
> (In reply to Richard Biener from comment #7)
> > What unswitch produces still looks OK. Instead of if (a4 == 0) return;
> > we'll do if (a4 == a5) if (a4 == 0) return; But the inner if is gone
> > in .optimized, DOM3/threadfull2/VRP2 remove it.
> >
> > I suspect sth is amiss with ranger/relations, we have some unreachable ()
> > on some unrelated path.
> >
> > Andrew, can you have a look please?
>
> I'll look later when I get a chance, but at first glance on my build, it
> shows
>
> q.i.225t.cddce3:Deleting : if (a4_14(D) == 0B)
>
> its there through store-merging, and then cddce3 deleted the second if... ?
There's three of them, one guarding an unreachable path (but we don't reach
that at runtime):
a-t.c.211t.thread2: if (a4_14(D) == a5_16(D))
a-t.c.211t.thread2: if (a4_14(D) == 0B)
a-t.c.211t.thread2: if (a4_14(D) == 0B)
a-t.c.212t.dom3:Folding predicate a4_14(D) == 0B to 0
a-t.c.212t.dom3: if (a4_14(D) == a5_16(D))
a-t.c.212t.dom3: if (a4_14(D) == 0B)
DOM3 elided the important one. CDDCE3 elides
- <bb 3> [count: 0]:
- if (a4_14(D) == 0B)
- goto <bb 15>; [4.02%]
- else
- goto <bb 4>; [95.98%]
-
- <bb 4> [count: 0]:
- f11_c17.1_29 = f11_c17;
- goto <bb 15>; [100.00%]
...
- <bb 15> [local count: 396743138]:
+ <bb 13> [local count: 396743138]:
<L12>:
return;
because the code in BB4 is dead now, but that's fine.
More information about the Gcc-bugs
mailing list