[llvm-bugs] [Bug 39128] New: Building LLVM 7.0 with libstdc++ 8, clang 6 and MemorySanitizer enabled failes on invocation of llvm-tblgen

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Sep 29 05:34:11 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=39128

            Bug ID: 39128
           Summary: Building LLVM 7.0 with libstdc++ 8, clang 6 and
                    MemorySanitizer enabled failes on invocation of
                    llvm-tblgen
           Product: new-bugs
           Version: 7.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: t.klatt.oss at mailbox.org
                CC: llvm-bugs at lists.llvm.org

I'm trying to build (at least) libcxx and libcxxabi with MemorySanitizer in
order to reduce false positives when using MemorySanitizer with my own code.

I'm using the Clang 6.0 as provided via Ubuntu packages and the following CMake
call:

cmake -GNinja -DCMAKE_INSTALL_PREFIX=/opt/llvm/dist/7.0.0 \
  -DCMAKE_C_COMPILER=/usr/bin/clang \
  -DCMAKE_CXX_COMPILER=/usr/bin/clang++ \
  -DCMAKE_BUILD_TYPE=Release \
  -DLLVM_INCLUDE_EXAMPLES=OFF \
  -DLLVM_INCLUDE_BENCHMARKS=OFF \
  -DLLVM_INCLUDE_TESTS=OFF \
  -DLLVM_USE_LINKER=gold \
  -DLLVM_BUILD_LLVM_DYLIB=ON \
  -DLLVM_CCACHE_BUILD=ON \
  -DLLVM_CCACHE_DIR=/opt/llvm/ccache \
  -DLLVM_USE_SANITIZER=Memory \
  -DLLVM_ENABLE_PROJECTS="clang;libcxx;libcxxabi;openmp;compiler-rt;lld;polly"
\
  /opt/llvm/src/7.0.0/llvm

and subsequently

$> ninja all
[  3% - 4327/6/180 at 2.1 - 83.887] Building Attributes.inc...
FAILED: include/llvm/IR/Attributes.inc.tmp 
cd /opt/llvm/build/7.0.0 && /opt/llvm/build/7.0.0/bin/llvm-tblgen -gen-attrs -I
/opt/llvm/src/7.0.0/llvm/include/llvm/IR -I /opt/llvm/src/7.0.0/llvm/include
/opt/llvm/src/7.0.0/llvm/include/llvm/IR/Attributes.td -o
include/llvm/IR/Attributes.inc.tmp -d include/llvm/IR/Attributes.inc.d
==8842==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x6a6aaf in _M_lower_bound
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_tree.h:1903:7
    #1 0x6a6aaf in find
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_tree.h:2552
    #2 0x6a6aaf in find
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_map.h:1195
    #3 0x6a6aaf in llvm::RecordKeeper::getClass(llvm::StringRef) const
/opt/llvm/src/7.0.0/llvm/include/llvm/TableGen/Record.h:1612
    #4 0xb4ae6e in llvm::TGParser::ParseClass()
/opt/llvm/src/7.0.0/llvm/lib/TableGen/TGParser.cpp:2648:28
    #5 0xb4ac7b in llvm::TGParser::ParseObject(llvm::MultiClass*)
/opt/llvm/src/7.0.0/llvm/lib/TableGen/TGParser.cpp:3010:12
    #6 0xb527ca in llvm::TGParser::ParseFile()
/opt/llvm/src/7.0.0/llvm/lib/TableGen/TGParser.cpp:3022:9
    #7 0xac535f in llvm::TableGenMain(char*, bool (*)(llvm::raw_ostream&,
llvm::RecordKeeper&)) /opt/llvm/src/7.0.0/llvm/lib/TableGen/Main.cpp:96:14
    #8 0x9f3163 in main
/opt/llvm/src/7.0.0/llvm/utils/TableGen/TableGen.cpp:247:10
    #9 0x7fccbb16bb96 in __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
    #10 0x424b29 in _start (/opt/llvm/build/7.0.0/bin/llvm-tblgen+0x424b29)

SUMMARY: MemorySanitizer: use-of-uninitialized-value
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_tree.h:1903:7
in _M_lower_bound
Exiting
[  4% - 4327/1/185 at 2.1 - 86.645] Building CXX object
lib/MC/CMakeFiles/LLVMMC.dir/ELFObjectWriter.cpp.o
ninja: build stopped: subcommand failed.


It seems, Clang is using the libstdc++ from the GCC 8 installation (via Ubuntu
packages).

$> /usr/bin/gcc-8 --version
gcc-8 (Ubuntu 8.2.0-1ubuntu2~18.04) 8.2.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$> /usr/bin/clang --version
clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin


I'm happy to provide further information.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180929/7855903c/attachment.html>


More information about the llvm-bugs mailing list