Skip to content

Add Memory Sanitizer Check to CI #12

@coder3101

Description

@coder3101

Memory Sanitizer helps in finding uninitialized use of variables, leaks and other memory-related behaviour that causes can cause UB.

However, due to restricting nature of MEMSAN and limitations, it is only available with clang and is hard to setup correctly. From discussion on #11

I have added the memory sanitizer but here is a problem.

Not uBLAS.tensor but Boost. Test framework has an issue of memory-sanitizer use of uninitialized value. I am not sure if it is really a true issue or false positive of MEMSAN. See this error report from Memory Sanitizer. However, I see many Stackoverflow questions that mention false positives for MEMSAN. Even its wiki says some things to do before using MEMSAN.

If you want MemorySanitizer to work properly and not produce any false positives, you must ensure that all the code in your program and in libraries it uses is instrumented (i.e. built with -fsanitize=memory). In particular, you would need to link against MSan-instrumented C++ standard library. We recommend using libc++ for that purpose.
See https://github.com/google/sanitizers/wiki/MemorySanitizerLibcxxHowTo

I even tried using libc++ and linked a demo code to it with sanitizer enabled and got uninitialized use of memory error for std::cout<<"Hello world". See this:

image

The current CI is failing for Linux Clang due to the above sanitizer reported an error in Boost. Test

Metadata

Metadata

Assignees

No one assigned

    Labels

    ciContinuous Integration related IssuesenhancementNew feature or requestfuture-workDeferred to be worked in later stage of GSOC or after GSOC

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions