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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
For (ignore the strict aliasing issue):
```
typedef signed _BitInt(256) B;

[[gnu::noinline]]
B
foo (signed char c, B b)
{
  return b % c;
}

int
main (void)
{
  B x = foo (1, -3); // -3 % 1 -> 0
 // if (x)
 //   __builtin_abort();
    signed long *t = (signed long *)&x;
  for(int i = 0;i < sizeof(B)/sizeof(long); i++ )
  {
    __builtin_printf("%lx\n", t[i]);
  }
  return 0;
}
```
We get:
```
0
ffffffffffffffff
ffffffffffffffff
ffffffffffffffff
```

Which makes it seem like we are doing the sign extend when the value was the
result was 0.

Even:
> B x = foo (3, -3); // -3 % 3 -> 0

Gives the wrong similar result.

Reply via email to