https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106078
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #2)
> (In reply to Jan Hubicka from comment #1)
> > This is version that does not need -fnon-call-exceptions
> > If called test (NULL, 0) it should be indefinitely increasing val rather
> > then segfaulting. Seems clang gets this one right.
> >
> > int array[10000];
> > volatile int val;
> > int test(short *b,int s)
> > {
> > for (int i = 0; i<10000;i++)
> > {
> > for (int j = 0; j < 10; j+=s)
> > val++;
> > array[i]+=*b;
> > }
> > }
>
> For this one it's PRE hoisting *b across the endless loop (PRE handles
> calls as possibly not returning but not loops as possibly not terminating...)
> So it's a different bug.
Btw, C++ requiring forward progress makes the testcase undefined.