[Bug c/80341] gcc miscompiles division of signed char

mpolacek at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Apr 6 12:24:00 GMT 2017


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

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Better testcase:

const signed char c = -84;
signed char s;

void
foo ()
{
  s = (unsigned short) c / -55;
}

int
main ()
{
  foo ();
  if (s != 90)
    __builtin_abort ();
}


More information about the Gcc-bugs mailing list