Open
Description
This happens when:
- Using
-O1
or above, without specifying-fno-inline
- Using
integer-sign-change
suppressions based on function name, as opposed to file name
Steps to reproduce:
$ cat << 'EOF_CPP' > /tmp/a.cpp && cat << 'EOF_SUPP_ISAN' > /tmp/supp_isan
int fun(unsigned a) { return a; }
int main() { (void)fun(4294961650); }
EOF_CPP
implicit-integer-sign-change:fun
EOF_SUPP_ISAN
$ bld/bin/clang++ -O1 -g -std=c++11 -fsanitize=integer -o /tmp/a.exe /tmp/a.cpp && UBSAN_OPTIONS="suppressions=/tmp/supp_isan:print_stacktrace=1:halt_on_error=1:report_error_type=1" /tmp/a.exe
/tmp/a.cpp:1:30: runtime error: implicit conversion from type 'unsigned int' of value 4294961650 (32-bit, unsigned) to type 'int' changed the value to -5646 (32-bit, signed)
#0 0x560fd5739b46 in fun(unsigned int) /tmp/a.cpp:1:30
#1 0x560fd5739b46 in main /tmp/a.cpp:2:20
...
#4 0x560fd570d3f4 in _start (/tmp/a.exe+0x13f4)
SUMMARY: UndefinedBehaviorSanitizer: implicit-integer-sign-change /tmp/a.cpp:1:30
$ bld/bin/clang++ -fno-inline -O1 -g -std=c++11 -fsanitize=integer -o /tmp/a.exe /tmp/a.cpp && UBSAN_OPTIONS="suppressions=/tmp/supp_isan:print_stacktrace=1:halt_on_error=1:report_error_type=1" /tmp/a.exe
(works)