[Bug middle-end/106078] Invalid loop invariant motion with non-call-exceptions

hubicka at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jun 24 11:40:20 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106078

--- Comment #1 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
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;
          }
}


More information about the Gcc-bugs mailing list