https://bugs.llvm.org/show_bug.cgi?id=44054
Bug ID: 44054
Summary: Missing overflow check for ++x compared to x += 1
Product: compiler-rt
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: ubsan
Assignee: unassignedb...@nondot.org
Reporter: cullm...@absint.de
CC: llvm-bugs@lists.llvm.org
If you use this example:
int main()
{
signed char x = 127;
x += 1;
return 0;
}
with -fsanitize=integer you get a proper:
main.cpp:4:7: runtime error: implicit conversion from type 'int' of value 128
(32-bit, signed) to type 'signed char' changed the value to -128 (8-bit,
signed)
If you alter this to
int main()
{
signed char x = 127;
++x;
return 0;
}
no longer any check is done. In the IR already the call to the overflow stuff
is missing.
I am not sure if this is the right component to report, thought.
(Or if I miss some option to get this kind of overflow alarm)
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs