[llvm-bugs] [Bug 45205] New: libcxx string optimization breaks tblgen on POWER

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Mar 14 11:41:13 PDT 2020


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

            Bug ID: 45205
           Summary: libcxx string optimization breaks tblgen on POWER
           Product: libc++
           Version: 10.0
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: W1RPUJQXS5D0SRW18WKS6EZ4HKORNX at cmx.ietfng.org
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com

a8a9c8e0a11abc9ed4ed78fed528334371fedf87 / D72160 causes a LLVM built on my
Power9 build box to fail to be able to compile itself.  tblgen bails with

cd /cheri/build/llvm-project-build &&
/cheri/build/llvm-project-build/bin/clang-tblgen -gen-clang-diags-defs
-clang-component=Refactoring -I /cheri/source/llvm-project/clang/include -I
/cheri/source/llvm-project/clang/include/clang/Basic -I /cheri/source/llvm-pro
ject/llvm/include
/cheri/source/llvm-project/clang/include/clang/Basic/Diagnostic.td
--write-if-changed -o
tools/clang/include/clang/Basic/DiagnosticRefactoringKinds.inc -d
tools/clang/include/clang/Basic/DiagnosticRefactoringKinds.inc.d
realloc(): invalid next size
 #0 0x0000000010186410 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/cheri/source/llvm-project/llvm/lib/Support/Unix/Signals.inc:564:13
 #1 0x0000000010186410 PrintStackTraceSignalHandler(void*)
/cheri/source/llvm-project/llvm/lib/Support/Unix/Signals.inc:656:3
 #2 0x0000000010183498 llvm::sys::RunSignalHandlers()
/cheri/source/llvm-project/llvm/lib/Support/Signals.cpp:67:5
 #3 0x0000000010186c84 SignalHandler(int)
/cheri/source/llvm-project/llvm/lib/Support/Unix/Signals.inc:396:3
 #4 0x00007fff8ee704d8 (linux-vdso64.so.1+0x4d8)
 #5 0x00007fff8e8259c8 __libc_signal_restore_set
/build/glibc-hxXnX3/glibc-2.29/signal/../sysdeps/unix/sysv/linux/internal-signals.h:84:10
 #6 0x00007fff8e8259c8 raise
/build/glibc-hxXnX3/glibc-2.29/signal/../sysdeps/unix/sysv/linux/raise.c:48:3
 #7 0x00007fff8e807c8c abort /build/glibc-hxXnX3/glibc-2.29/stdlib/abort.c:79:7
 #8 0x00007fff8e870c7c __libc_message
/build/glibc-hxXnX3/glibc-2.29/libio/../sysdeps/posix/libc_fatal.c:181:7
 #9 0x00007fff8e87a408 malloc_printerr
/build/glibc-hxXnX3/glibc-2.29/malloc/malloc.c:5366:3                           
#10 0x00007fff8e87f6ac _int_realloc
/build/glibc-hxXnX3/glibc-2.29/malloc/malloc.c:4576:5                           
#11 0x00007fff8e880bc8 realloc
/build/glibc-hxXnX3/glibc-2.29/malloc/malloc.c:3230:7                           
#12 0x000000001013d234 llvm::SmallVectorBase::grow_pod(void*, unsigned long,
unsigned long)
/cheri/source/llvm-project/llvm/include/llvm/Support/MemAlloc.h:53:18           
#13 0x00000000101ca198 llvm::SmallVectorTemplateCommon<llvm::RecordVal,
void>::grow_pod(unsigned long, unsigned long)
/cheri/source/llvm-project/llvm/include/llvm/ADT/SmallVector.h:100:22
#14 0x00000000101ca198 llvm::SmallVectorTemplateBase<llvm::RecordVal,
true>::grow(unsigned long)
/cheri/source/llvm-project/llvm/include/llvm/ADT/SmallVector.h:301:41
#15 0x00000000101ca198 llvm::SmallVectorTemplateBase<llvm::RecordVal,
true>::push_back(llvm::RecordVal const&)
/cheri/source/llvm-project/llvm/include/llvm/ADT/SmallVector.h:306:13
#16 0x00000000101ca198 llvm::Record::addValue(llvm::RecordVal const&)
/cheri/source/llvm-project/llvm/include/llvm/TableGen/Record.h:1547:12
#17 0x00000000101ca198 llvm::TGParser::AddValue(llvm::Record*, llvm::SMLoc,
llvm::RecordVal const&)
/cheri/source/llvm-project/llvm/lib/TableGen/TGParser.cpp:152:13
#18 0x00000000101cb044 llvm::TGParser::AddSubClass(llvm::Record*,
llvm::SubClassReference&)
/cheri/source/llvm-project/llvm/lib/TableGen/TGParser.cpp:232:9
#19 0x00000000101d80ec llvm::TGParser::ParseObjectBody(llvm::Record*)
/cheri/source/llvm-project/llvm/lib/TableGen/TGParser.cpp:2730:11
#20 0x00000000101d83a0 llvm::TGParser::ParseDef(llvm::MultiClass*)
/cheri/source/llvm-project/llvm/lib/TableGen/TGParser.cpp:2767:7
#21 0x00000000101d8f40 llvm::TGParser::ParseObject(llvm::MultiClass*)
/cheri/source/llvm-project/llvm/lib/TableGen/TGParser.cpp:3399:29
#22 0x00000000101da5ec llvm::TGParser::ParseObjectList(llvm::MultiClass*)
/cheri/source/llvm-project/llvm/lib/TableGen/TGParser.cpp:3426:9
#23 0x00000000101da5ec llvm::TGParser::ParseTopLevelLet(llvm::MultiClass*)
/cheri/source/llvm-project/llvm/lib/TableGen/TGParser.cpp:3143:9
#24 0x00000000101d8f64 llvm::TGParser::ParseObject(llvm::MultiClass*)
/cheri/source/llvm-project/llvm/lib/TableGen/TGParser.cpp:3398:29
#25 0x00000000101da5ec llvm::TGParser::ParseObjectList(llvm::MultiClass*)
/cheri/source/llvm-project/llvm/lib/TableGen/TGParser.cpp:3426:9
#26 0x00000000101da5ec llvm::TGParser::ParseTopLevelLet(llvm::MultiClass*)
/cheri/source/llvm-project/llvm/lib/TableGen/TGParser.cpp:3143:9
#27 0x00000000101d8f64 llvm::TGParser::ParseObject(llvm::MultiClass*)
/cheri/source/llvm-project/llvm/lib/TableGen/TGParser.cpp:3398:29
#28 0x00000000101dc08c llvm::TGParser::ParseObjectList(llvm::MultiClass*)
/cheri/source/llvm-project/llvm/lib/TableGen/TGParser.cpp:3426:9
#29 0x00000000101dc08c llvm::TGParser::ParseFile()
/cheri/source/llvm-project/llvm/lib/TableGen/TGParser.cpp:3434:7
#30 0x0000000010193a80 llvm::TableGenMain(char*, bool (*)(llvm::raw_ostream&,
llvm::RecordKeeper&))
/cheri/source/llvm-project/llvm/lib/TableGen/Main.cpp:102:14
#31 0x0000000010118e74 main
/cheri/source/llvm-project/clang/utils/TableGen/TableGen.cpp:382:10
#32 0x00007fff8e808328 generic_start_main
/build/glibc-hxXnX3/glibc-2.29/csu/../csu/libc-start.c:308:16
#33 0x00007fff8e808524 __libc_start_main
/build/glibc-hxXnX3/glibc-2.29/csu/../sysdeps/unix/sysv/linux/powerpc/libc-start.c:116:10
Stack dump:                                       
0.      Program arguments: /cheri/build/llvm-project-build/bin/clang-tblgen
-gen-clang-diags-defs -clang-component=Refactoring -I
/cheri/source/llvm-project/clang/include -I
/cheri/source/llvm-project/clang/include/clang/Basic -I
/cheri/source/llvm-project/llvm/i
nclude /cheri/source/llvm-project/clang/include/clang/Basic/Diagnostic.td
--write-if-changed -o
tools/clang/include/clang/Basic/DiagnosticRefactoringKinds.inc -d
tools/clang/include/clang/Basic/DiagnosticRefactoringKinds.inc.d
Aborted (core dumped)

For this machine, `uname -a` reports "Linux 31a6da1f1be8 4.19.0-6-powerpc64le
#1 SMP Debian 4.19.67-2+deb10u2 (2019-11-11) ppc64le GNU/Linux".  I am building
LLVM using its internal libc++; the complete build command lines are...

cd /cheri/build/llvm-project-build && /usr/bin/cmake
/cheri/source/llvm-project/llvm -GNinja -DCMAKE_BUILD_TYPE=Release
-DLLVM_PARALLEL_LINK_JOBS=8 -DPYTHON_EXECUTABLE=/usr/bin/python3
-DLLVM_INSTALL_BINUTILS_SYMLINKS=ON -DLLVM_ENABLE_OCAMLDOC=OFF -DLLVM_ENABLE_B
INDINGS=OFF -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_DOCS=OFF
-DLLVM_INCLUDE_BENCHMARKS=OFF -DLLVM_LINK_LLVM_DYLIB=ON
-DLIBCXXABI_USE_LLVM_UNWINDER=ON -DCLANG_DEFAULT_CXX_STDLIB=libc++
-DCLANG_DEFAULT_RTLIB=compiler-rt -DCLANG_ENABLE_STATIC_ANALYZER=OFF -DCLANG
_ENABLE_ARCMT=OFF -DCLANG_ANALYZER_ENABLE_Z3_SOLVER=OFF
-DLLVM_TOOL_LLVM_MCA_BUILD=OFF -DLLVM_TOOL_LLVM_EXEGESIS_BUILD=OFF
-DLLVM_TOOL_LLVM_RC_BUILD=OFF -DLLVM_ENABLE_LLD=ON
-DLLVM_OPTIMIZED_TABLEGEN=OFF -DLLVM_USE_SPLIT_DWARF=ON
-DLLVM_ENABLE_ASSERTIONS=ON '-DLL
VM_LIT_ARGS=--max-time 3600 --timeout 300 -s -vv'
'-DLLVM_ENABLE_PROJECTS=llvm;clang;lld;libcxx;libcxxabi;compiler-rt;libunwind'
-DCMAKE_INSTALL_PREFIX=/cheri/out/sdk -DCMAKE_C_COMPILER=/usr/lib/ccache/clang
-DCMAKE_CXX_COMPILER=/usr/lib/ccache/clang++ -DCMAKE_AS
M_COMPILER=/usr/lib/ccache/clang
cd /cheri/build/llvm-project-build && nice ninja all -j160


Reverting the indicated commit makes things fine again, but it's possible that
the indicated commit is merely exposing some other bug rather than being the
actual root cause.  Please let me know what additional information would be
useful to have.

-- 
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/20200314/ccc3473d/attachment-0001.html>


More information about the llvm-bugs mailing list