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

2017-04-06 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80341 --- Comment #6 from Richard Biener --- Ah, it is as we pass it signed char as 2nd arg...

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

2017-04-06 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80341 Richard Biener changed: What|Removed |Added Status|UNCONFIRMED |ASSIGNED Last reconfirmed|

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

2017-04-06 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80341 --- Comment #4 from Marek Polacek --- With -O I get x.c: In function ‘foo’: x.c:7:7: warning: overflow in implicit constant conversion [-Woverflow] s = (unsigned short) c / -55; ^

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

2017-04-06 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80341 --- Comment #3 from Marek Polacek --- Likely started with commit 4d307e1ff39d0c2f90123ef789d611e2323be76d Author: rguenth Date: Wed Feb 10 11:54:14 2010 + 2010-02-10 Richard Guenther PR c/43007 * tree.c (g

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

2017-04-06 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80341 --- Comment #2 from Marek Polacek --- 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 (); }

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

2017-04-06 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80341 Marek Polacek changed: What|Removed |Added CC||mpolacek at gcc dot gnu.org --- Comment