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

--- Comment #6 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Gian-Carlo Pascutto from comment #4)
> Further reduced testcase:
> 
> #include <stdint.h>
> 
> uint64_t f(uint64_t x) {
>     return ((uint32_t)x << 55) | ((uint32_t)x >> -23);
> }
> 
> This makes it more clear the code is UB, but AFAIK a compiler ICE doesn't
> fall under allowable UB :-)

I have following, somehow less UB testcase:

--cut here--
/* PR target/81471 */
/* { dg-do compile { target { ! ia32 } } } */
/* { dg-options "-O2 -mbmi2" } */

static inline unsigned int rotl (unsigned int x, int k)
{
  return (x << k) | (x >> (32 - k));
}

unsigned long long test (unsigned int z)
{
  return rotl (z, 55);
}
--cut here--

Reply via email to