https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123637
Sam James <sjames at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |sjames at gcc dot gnu.org
--- Comment #1 from Sam James <sjames at gcc dot gnu.org> ---
$ export
UBSAN_OPTIONS="halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1"
# nicer errors
$ gcc l.c -o l -fsanitize=undefined
$ ./l
a = 0.998000
l.c:22:7: runtime error: signed integer overflow: 4286377361 * 4286377361
cannot be represented in type 'long long int'
#0 0x55ce20eb5581 in main (/tmp/l+0x581) (BuildId:
ad430d2b3b7cc575e3722d0f2d916690ff4ebc13)
#1 0x7f754ee035c6 (/usr/lib64/libc.so.6+0x35c6) (BuildId:
6cdb6ce0f26035ae4797a6b2bcf18f8bd2bc847f)
#2 0x7f754ee03675 in __libc_start_main (/usr/lib64/libc.so.6+0x3675)
(BuildId: 6cdb6ce0f26035ae4797a6b2bcf18f8bd2bc847f)
#3 0x55ce20eb53d0 in _start (/tmp/l+0x3d0) (BuildId:
ad430d2b3b7cc575e3722d0f2d916690ff4ebc13)
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior l.c:22:7
Aborted (core dumped) ./l
$ clang l.c -o l -fsanitize=undefined
$ ./l
a = 0.998000
l.c:22:7: runtime error: signed integer overflow: 4286377361 * 4286377361
cannot be represented in type 's64' (aka 'long long')
#0 0x55ccc7657d56 in main (/tmp/l+0x2cd56)
#1 0x7f9f69a035c6 (/usr/lib64/libc.so.6+0x35c6) (BuildId:
6cdb6ce0f26035ae4797a6b2bcf18f8bd2bc847f)
#2 0x7f9f69a03675 in __libc_start_main (/usr/lib64/libc.so.6+0x3675)
(BuildId: 6cdb6ce0f26035ae4797a6b2bcf18f8bd2bc847f)
#3 0x55ccc762b700 in _start (/tmp/l+0x700)
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior l.c:22:7
Aborted (core dumped) ./l