http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60613
Bug ID: 60613
Summary: Invalid signed subtraction ubsan diagnostics
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: sanitizer
Assignee: jakub at gcc dot gnu.org
Reporter: jakub at gcc dot gnu.org
CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
jakub at gcc dot gnu.org, kcc at gcc dot gnu.org
On x86_64-linux with -O2 -m32 -fsanitize=undefined on:
__attribute__((noinline, noclone)) long long
foo (long long y)
{
asm ("");
return 8LL - y;
}
int
main ()
{
foo (1);
return 0;
}
we get invalid diagnostics:
runtime error: signed integer overflow: 8 - 1 cannot be represented in type
'long long int'