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

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

/* PR middle-end/93505 */

unsigned a;

unsigned
foo (unsigned x)
{
  unsigned int y = 32 - __builtin_bswap64 (-a);
  /* This would be UB (x << 32) at runtime.  Ensure we don't
     invoke UB in the compiler because of that (visible with
     bootstrap-ubsan).  */
  x = x << y | x >> (-y & 31);
  x >>= 31;
  return x;
}