MDEV-36316/MDEV-36327/MDEV-36328 Debug msan

Clang ~16+ on MSAN became quite strict with uninitalized
data being passed and returned from functions. Non-debug builds
have a basic optimization that hides these from those builds

Two innodb cases violate the assumptions, however once inlined
with a basic optimization those that existed for uninitialized
values are removed.

(MDEV-36316) rec_set_bit_field_2 calling mach_read_from_2 hits a read of
bits it wasn't actually changing.

(MDEV-36327) The function dict_process_sys_columns_rec left
nth_v_col uninitialized unless it was a virtual column. This was
ok as the function i_s_sys_columns_fill_table also didn't read
this value unless it was a virtual column.
This commit is contained in:
Daniel Black
2025-05-23 20:02:45 +10:00
parent 507cbde68f
commit df414933f1
2 changed files with 44 additions and 0 deletions

View File

@ -82,6 +82,14 @@ IF(WITH_INNOBASE_STORAGE_ENGINE)
)
# clang ~16+ with return values being undefined is resolved by basic optimization
# compiler flags for the function mach_read_from_2 (per MDEV-36316)
IF(WITH_MSAN AND CMAKE_BUILD_TYPE STREQUAL "Debug")
SET_SOURCE_FILES_PROPERTIES(
${INNOBASE_SOURCES}
innochecksum.cc
PROPERTIES COMPILE_FLAGS -Og)
ENDIF()
MYSQL_ADD_EXECUTABLE(innochecksum innochecksum.cc ${INNOBASE_SOURCES})
TARGET_LINK_LIBRARIES(innochecksum mysys mysys_ssl)
ADD_DEPENDENCIES(innochecksum GenError)