view gcc/testsuite/gcc.c-torture/compile/pr50380.c @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 04ced10e8804
children
line wrap: on
line source

__attribute__ ((__noreturn__)) extern void fail (void);

char x;

/* This used to get stuck in an infinite loop in find_comparison_args
   when compiling this function for MIPS at -O2.  */

void foo (const unsigned char y)
{
   ((void) (__builtin_expect((!! y == y), 1) ? 0 : (fail (), 0)));
   x = ! y;
}

/* This used to similarly get stuck when compiling for PowerPC at -O2.  */

int foo2 (int arg)
{
  if (arg != !arg)
    fail ();
  if (arg)
    fail ();
}