http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60814
Bug ID: 60814 Summary: incorrect integer promotion when multiplying unsigned short values Product: gcc Version: 4.8.2 Status: UNCONFIRMED Severity: major Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: mikulas at artax dot karlin.mff.cuni.cz Host: x86_64-unknown-linux-gnu Target: x86_64-unknown-linux-gnu Build: x86_64-unknown-linux-gnu Created attachment 32582 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32582&action=edit incorrect integer promotion The attached program triggers an optimizer bug with -O2 or -O3 (it performs correctly with -O1 or -O0). The unsigned -> unsigned long long promotion should be unsigned, but gcc incorrectly performs signed promotion. This bug seems to be architecture-independent, it was reproduced on: 4.7.2 (Debian 4.7.2-5) on i486-linux-gnu 4.7.2 (Debian 4.7.2-5) on ia64-linux-gnu 4.7.2 (Debian 4.7.2-5) on s390x-linux-gnu 4.7.3 on hppa-linux-gnu 4.8.2 on x86_64-unknown-linux-gnu (the bug is in 32-bit, 64-bit and x32 mode) 4.8.2 (Ubuntu/Linaro 4.8.2-19ubuntu1) on arm-linux-gnueabihf 4.8.2 (Debian 4.8.2-16) on alpha-linux-gnu The bug doesn't happen in gcc 4.6.4.