Skip to content

Cannot compile code that depends on CWPack with UndefinedBehaviorSanitizer in GCC #20

@dmitry-kabanov

Description

@dmitry-kabanov

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions