]> git.ipfire.org Git - thirdparty/gcc.git/commit
analyzer: handle more IFN_UBSAN_* as no-ops [PR118300]
authorDavid Malcolm <dmalcolm@redhat.com>
Wed, 19 Feb 2025 14:44:46 +0000 (09:44 -0500)
committerDavid Malcolm <dmalcolm@redhat.com>
Wed, 19 Feb 2025 14:44:46 +0000 (09:44 -0500)
commit58b90139e093aeb5494627d92257a97aebb4a6d9
tree3c27b8cb7538e1bee3a48e58a4ed838cd87607de
parent25256ec1df10f2eb183e1c1ab0c890e9fdd94384
analyzer: handle more IFN_UBSAN_* as no-ops [PR118300]

Previously the analyzer treated IFN_UBSAN_BOUNDS as a no-op, but
the other IFN_UBSAN_* were unrecognized and conservatively treated
as having arbitrary behavior.

Treat IFN_UBSAN_NULL and IFN_UBSAN_PTR also as no-ops, which should
make -fanalyzer behave better with -fsanitize=undefined.

gcc/analyzer/ChangeLog:
PR analyzer/118300
* kf.cc (class kf_ubsan_bounds): Replace this with...
(class kf_ubsan_noop): ...this.
(register_sanitizer_builtins): Use it to handle IFN_UBSAN_NULL,
IFN_UBSAN_BOUNDS, and IFN_UBSAN_PTR as nop-ops.
(register_known_functions): Drop handling of IFN_UBSAN_BOUNDS
here, as it's now handled by register_sanitizer_builtins above.

gcc/testsuite/ChangeLog:
PR analyzer/118300
* gcc.dg/analyzer/ubsan-pr118300.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
gcc/analyzer/kf.cc
gcc/testsuite/gcc.dg/analyzer/ubsan-pr118300.c [new file with mode: 0644]