[Bug c/42544] New: Bad codegen with signed short cast to unsigned int, then promoted to unsigned long long
foo at mailinator dot com
gcc-bugzilla@gcc.gnu.org
Tue Dec 29 18:12:00 GMT 2009
extern int puts(const char *);
int main() {
signed short ffff8000 = 0xffff8000;
if ((unsigned int)ffff8000 >= 0x100000000uLL) {
puts("FAIL");
}
return 0;
}
% gcc --version
gcc (GCC) 4.2.4 (Ubuntu 4.2.4-1ubuntu4)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
% gcc -w test.c
% ./a.out
FAIL
Also reproduces with gcc-snapshot (Ubuntu 20090125-0ubuntu1) 4.3.3.
--
Summary: Bad codegen with signed short cast to unsigned int, then
promoted to unsigned long long
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: foo at mailinator dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42544
More information about the Gcc-bugs
mailing list