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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
It is not just ICE, but also a wrong-code starting with GCC 4.3:
int x, y;

__attribute__((noipa)) int
foo (int z)
{
  if (__builtin_expect (x ? y != 0 : 0, z++))
    return 7;
  return z;
}

int
main ()
{
  x = 1;
  asm volatile ("" : "+m" (x), "+m" (y));
  if (foo (10) != 11)
    __builtin_abort ();
  return 0;
}

The side-effects of the second __builtin_expect argument are evaluated multiple
times.

Reply via email to