https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80501
Bug ID: 80501 Summary: [6/7/8 Regression] Wrong code w/ a signed char, a shift, and a conversion to int Product: gcc Version: 8.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: asolokha at gmx dot com Target Milestone: --- Target: x86_64-pc-linux-gnu gcc starting from 6 apparently miscompiles the following snippet at -O1, -O2, -Os, -O3, or -Ofast: signed char tb = 0; static signed char um (int ov, int rc) { return ov << rc; } int main (void) { return um(tb >= 0, 7) >= 1; } % gcc-5.4.0 -O0 henaauhf.c && ./a.out % gcc-5.4.0 -O1 henaauhf.c && ./a.out % x86_64-pc-linux-gnu-gcc-7.0.0-alpha20170416 -O0 henaauhf.c && ./a.out % x86_64-pc-linux-gnu-gcc-7.0.0-alpha20170416 -O1 henaauhf.c && ./a.out zsh: exit 1 ./a.out