CWPack icon indicating copy to clipboard operation
CWPack copied to clipboard

Cannot compile code that depends on CWPack with UndefinedBehaviorSanitizer in GCC

Open dmitry-kabanov opened this issue 6 months ago • 0 comments

Hi, I am trying to compile the code that depends on CWPack, using GCC sanitizers modules (that help find bugs in software):

string(APPEND CMAKE_C_FLAGS_DEBUG
       " -fno-omit-frame-pointer -fsanitize=address,leak,undefined")
string(APPEND CMAKE_CXX_FLAGS_DEBUG
       " -fno-omit-frame-pointer -fsanitize=address,leak,undefined")
string(APPEND CMAKE_LINKER_FLAGS_DEBUG
       " -fno-omit-frame-pointer -fsanitize=address,leak,undefined")

However, when running the code, I get the following problems:

build.debug/_deps/cwpack-src/src/cwpack.c:135:13: runtime error: store to misaligned address 0x60c0000007cf for type 'uint16_t', which requires 2 byte alignment
0x60c0000007cf: note: pointer points here
 65 70 73 cd be  be be be be be be be be  be be be be be be be be  be be be be be be be be  be be be

dmitry-kabanov avatar Jul 10 '25 16:07 dmitry-kabanov