From 31b7fd602a2bd89e787939254048f1b51bea9436 Mon Sep 17 00:00:00 2001
From: Sergey Bronnikov <estetus@gmail.com>
Date: Wed, 16 Oct 2024 13:52:28 +0300
Subject: [PATCH] cmake: enable UBsan checks

The following UBSan checks have been enabled back:

- vptr
- implicit-signed-integer-truncation
- implicit-integer-sign-change
- nullability-arg
- nullability-assign
- nullability-return
- returns-nonnull-attribute

These checks doesn't trigger errors anymore and no sense to keep
them disabled.

Part of #10228
Related to #10741
Related to #10740

NO_CHANGELOG=codehealth
NO_DOC=codehealth
NO_TEST=codehealth

(cherry picked from commit e65b63df7f5a8a628cd9a9bbc6a1bdecec8c9959)
---
 cmake/compiler.cmake | 24 +++++-------------------
 1 file changed, 5 insertions(+), 19 deletions(-)

diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake
index 8cd1e24761..12e94cfd00 100644
--- a/cmake/compiler.cmake
+++ b/cmake/compiler.cmake
@@ -246,32 +246,18 @@ macro(enable_tnt_compile_flags)
             object-size
             # See https://github.com/tarantool/tarantool/issues/10742.
             pointer-overflow
-            # Intrusive data structures may abuse '&obj->member' on pointer
-            # 'obj' which is not really a pointer at an object of its type.
-            # For example, rlist uses '&item->member' expression in macro cycles
-            # to check end of cycle, but on the last iteration 'item' points at
-            # the list metadata head, not at an object of type stored in this
-            # list.
-            vptr
             # Integer overflow and truncation are disabled due to extensive
             # usage of this UB in SQL code to 'implement' some kind of int65_t.
-            implicit-signed-integer-truncation
-            implicit-integer-sign-change
             signed-integer-overflow
             # NULL checking is disabled, because this is not a UB and raises
             # lots of false-positive fails such as typeof(*obj) with
-            # obj == NULL, or memcpy() with NULL argument and 0 size. All
-            # nullability sanitations are disabled, because from the tests it
-            # seems they implicitly turn each other on, when one is used. For
-            # example, having "returns-nonnull-attribute" may lead to fail in
-            # the typeof(*obj) when obj is NULL, even though there is nothing
-            # related to return.
+            # obj == NULL, or memcpy() with NULL argument and 0 size.
+            # "UBSan: check null is globally suppressed",
+            # https://github.com/tarantool/tarantool/issues/10741
             null
+            # "UBSan: check nonnull-attribute is globally suppressed",
+            # https://github.com/tarantool/tarantool/issues/10740
             nonnull-attribute
-            nullability-arg
-            returns-nonnull-attribute
-            nullability-assign
-            nullability-return
             # Not interested in function type mismatch errors.
             function
         )
-- 
GitLab