https://llvm.org/bugs/show_bug.cgi?id=25735
Bug ID: 25735 Summary: llvm::cl::ParseCommandLineOptions casue double free or corruption when in multithread Product: libraries Version: 3.7 Hardware: PC OS: Linux Status: NEW Severity: normal Priority: P Component: Support Libraries Assignee: unassignedb...@nondot.org Reporter: xiuli...@outlook.com CC: llvm-bugs@lists.llvm.org Classification: Unclassified We are using clang as a frontend, and we tried to use it in multithread, but the llvm::cl::ParseCommandLineOptions will cause double free or corruption (fasttop): 0x00007f36e40041d0 *** dump core backtrace shows that: (gdb) bt #0 0x00007f478493bf79 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56 #1 0x00007f478493f388 in __GI_abort () at abort.c:89 #2 0x00007f4784f416b5 in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #3 0x00007f4784f3f836 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #4 0x00007f4784f3f863 in std::terminate() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #5 0x00007f4784f4033f in __cxa_pure_virtual () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #6 0x00007f4780ca6885 in llvm::cl::Option::addOccurrence (this=0x7f47829a0c20 <InlineLimit>, pos=1, ArgName=..., Value=..., MultiArg=false) at /home/pxl/llvm/lib/Support/CommandLine.cpp:1140 #7 0x00007f4780ca1942 in CommaSeparateAndAddOccurrence (Handler=0x7f47829a0c20 <InlineLimit>, pos=1, ArgName=..., Value=..., MultiArg=false) at /home/pxl/llvm/lib/Support/CommandLine.cpp:348 #8 0x00007f4780ca1c1e in ProvideOption (Handler=0x7f47829a0c20 <InlineLimit>, ArgName=..., Value=..., argc=2, argv=0x7f477af6c3b8, i=@0x7f477af6bc98: 1) at /home/pxl/llvm/lib/Support/CommandLine.cpp:389 #9 0x00007f4780ca4f25 in (anonymous namespace)::CommandLineParser::ParseCommandLineOptions ( this=0x19d0160, argc=2, argv=0x7f477af6c3b8, Overview=0x0) at /home/pxl/llvm/lib/Support/CommandLine.cpp:990 #10 0x00007f4780ca3c18 in llvm::cl::ParseCommandLineOptions (argc=2, argv=0x7f475c004680, Overview=0x0) at /home/pxl/llvm/lib/Support/CommandLine.cpp:813 This bug does not happen in LLVM3.6, it seems the ParseCommandLineOptions was refined and it is wrapped by a static manager: [CommandLine.cpp] 00213 static ManagedStatic<CommandLineParser> GlobalParser; 00811 void cl::ParseCommandLineOptions(int argc, const char *const *argv, 00812 const char *Overview) { 00813 GlobalParser->ParseCommandLineOptions(argc, argv, Overview); 00814 } And this static manager make each thread using the same CommandLineParser object and cause this error. May be the GlobalParser should be a TLS to make sure it is a thread safe as other llvm component. -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs