Fix issues reported by gcc -fsanitize flag (#678)

And refine some coding styles, fix JIT compiler data wasm table create issue, add license header for some files.
This commit is contained in:
Wenyong Huang
2021-07-30 15:21:17 +08:00
committed by GitHub
parent 62fb3c9a89
commit 7cdfc9fe11
14 changed files with 84 additions and 108 deletions

View File

@ -109,8 +109,10 @@ if (WAMR_BUILD_TARGET MATCHES "X86_.*" OR WAMR_BUILD_TARGET STREQUAL "AMD_64")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mindirect-branch-register")
endif ()
# UNDEFINED BEHAVIOR, refer to https://en.cppreference.com/w/cpp/language/ub
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined -fno-sanitize-recover")
if(CMAKE_BUILD_TYPE STREQUAL "Debug" AND NOT WAMR_BUILD_JIT EQUAL 1)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined \
-fno-sanitize=bounds,bounds-strict,alignment \
-fno-sanitize-recover")
endif()
endif ()