https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81148
Bug ID: 81148
Summary: UBSAN: two more false positives
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: sanitizer
Assignee: unassigned at gcc dot gnu.org
Reporter: babokin at gmail dot com
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, marxin at
gcc dot gnu.org
Target Milestone: ---
gcc rev249427, x86_64.
> cat f.cpp
int x = -106;
int main() {
// -123 - (0x8000000000000000 - -1)
bool a = -123 - ((9223372036854775806 ^ ~(x && true)) - -1);
return 0;
}
> gcc -fsanitize=undefined f.cpp -o out
> ./out
f.cpp:4:41: runtime error: negation of -9223372036854775808 cannot be
represented in type 'long int'; cast to an unsigned type to negate this value
to itself
f.cpp:4:17: runtime error: signed integer overflow: -9223372036854775808 + -124
cannot be represented in type 'long int'