[Bug sanitizer/104929] UBSAN: false positive with sprintf

2022-03-15 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104929 --- Comment #3 from Jakub Jelinek --- In this particular case the problem is that UBSAN adds the non-NULL tests, so the IL becomes if (!s) __ubsan_handle_nonnull_arg (...); sprintf(s, " "); if (!s) __ubsan_handle_nonnull_arg (...); return __bui

[Bug sanitizer/104929] UBSAN: false positive with sprintf

2022-03-15 Thread schwab--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104929 --- Comment #2 from Andreas Schwab --- I think the point here is that s is not guaranteed to be non-NULL. You can add if (s == 0) __builtin_unreachable(); to suppress the warning.

[Bug sanitizer/104929] UBSAN: false positive with sprintf

2022-03-15 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104929 --- Comment #1 from Martin Liška --- It's a quite known limitation that usage of sanitizers tends to emit false positives of various warnings.