[llvm-bugs] [Bug 38254] New: Unable to output assembly for x86_64 mingw after "Fix GCC ABI compatibility for comdat things"

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jul 20 14:17:06 PDT 2018


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

            Bug ID: 38254
           Summary: Unable to output assembly for x86_64 mingw after "Fix
                    GCC ABI compatibility for comdat things"
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: MC
          Assignee: unassignedbugs at nondot.org
          Reporter: martin at martin.st
                CC: llvm-bugs at lists.llvm.org

In some cases, when compiling with clang with -S, to print output assembly,
asserts can be triggered after the commit "[mingw] Fix GCC ABI compatibility
for comdat things", SVN r335286.

Test case:

$ cat test-comdat.cpp
void other();
class Foo {
public:
    ~Foo() {
        other();
    }
};
Foo foo;
$ ./bin/clang -target x86_64-w64-mingw32 test-comdat.cpp -S -o -
clang-7: /home/martin/code/llvm/lib/MC/MCSectionCOFF.cpp:99: virtual void
llvm::MCSectionCOFF::PrintSwitchToSection(const llvm::MCAsmInfo&, const
llvm::Triple&, llvm::raw_ostream&, const llvm::MCExpr*) const: Assertion
`COMDATSymbol' failed.
Stack dump:
0.      Program arguments: /home/martin/code/llvm-build-debug/bin/clang-7 -cc1
-triple x86_64-w64-windows-gnu -S -disable-free -main-file-name test-comdat.cpp
-mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno
-masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64
-dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer
-coverage-notes-file /home/martin/code/llvm-build-debug/-.gcno -resource-dir
/home/martin/code/llvm-build-debug/lib/clang/7.0.0 -internal-isystem
/usr/x86_64-w64-mingw32/include/c++ -internal-isystem
/usr/x86_64-w64-mingw32/include/c++/x86_64-w64-mingw32 -internal-isystem
/usr/x86_64-w64-mingw32/include/c++/backward -internal-isystem
/usr/x86_64-w64-mingw32/include/c++/5.3-win32 -internal-isystem
/usr/x86_64-w64-mingw32/include/c++/5.3-win32/x86_64-w64-mingw32
-internal-isystem /usr/x86_64-w64-mingw32/include/c++/5.3-win32/backward
-internal-isystem /usr/include/c++/5.3-win32 -internal-isystem
/usr/include/c++/5.3-win32/x86_64-w64-mingw32 -internal-isystem
/usr/include/c++/5.3-win32/backward -internal-isystem
/usr/lib/gcc/x86_64-w64-mingw32/5.3-win32/include/c++ -internal-isystem
/usr/lib/gcc/x86_64-w64-mingw32/5.3-win32/include/c++/x86_64-w64-mingw32
-internal-isystem
/usr/lib/gcc/x86_64-w64-mingw32/5.3-win32/include/c++/backward
-internal-isystem /home/martin/code/llvm-build-debug/lib/clang/7.0.0/include
-internal-isystem /usr/x86_64-w64-mingw32/sys-root/mingw/include
-internal-isystem /usr/x86_64-w64-mingw32/include -internal-isystem
/usr/include -fdeprecated-macro -fdebug-compilation-dir
/home/martin/code/llvm-build-debug -ferror-limit 19 -fmessage-length 0
-fno-use-cxa-atexit -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fseh-exceptions -fdiagnostics-show-option -o - -x c++ test-comdat.cpp 
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'test-comdat.cpp'.
4.      Running pass 'X86 Assembly Printer' on function '@_ZN3FooD2Ev'
#0 0x00007fd5fe10856d llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/martin/code/llvm/lib/Support/Unix/Signals.inc:490:0
#1 0x00007fd5fe108600 PrintStackTraceSignalHandler(void*)
/home/martin/code/llvm/lib/Support/Unix/Signals.inc:554:0
#2 0x00007fd5fe10630e llvm::sys::RunSignalHandlers()
/home/martin/code/llvm/lib/Support/Signals.cpp:67:0
#3 0x00007fd5fe107f67 SignalHandler(int)
/home/martin/code/llvm/lib/Support/Unix/Signals.inc:353:0
#4 0x00007fd5fb15f4b0 (/lib/x86_64-linux-gnu/libc.so.6+0x354b0)
#5 0x00007fd5fb15f428 gsignal
/build/glibc-Cl5G7W/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
#6 0x00007fd5fb16102a abort /build/glibc-Cl5G7W/glibc-2.23/stdlib/abort.c:91:0
#7 0x00007fd5fb157bd7 __assert_fail_base
/build/glibc-Cl5G7W/glibc-2.23/assert/assert.c:92:0
#8 0x00007fd5fb157c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
#9 0x00007fd5fee64e2c llvm::MCSectionCOFF::PrintSwitchToSection(llvm::MCAsmInfo
const&, llvm::Triple const&, llvm::raw_ostream&, llvm::MCExpr const*) const
/home/martin/code/llvm/lib/MC/MCSectionCOFF.cpp:100:0
#10 0x00007fd5fee67ffb llvm::MCTargetStreamer::changeSection(llvm::MCSection
const*, llvm::MCSection*, llvm::MCExpr const*, llvm::raw_ostream&)
/home/martin/code/llvm/lib/MC/MCStreamer.cpp:61:0
#11 0x00007fd5fede1ed3 (anonymous
namespace)::MCAsmStreamer::ChangeSection(llvm::MCSection*, llvm::MCExpr const*)
/home/martin/code/llvm/lib/MC/MCAsmStreamer.cpp:432:0
#12 0x00007fd5fee6bfb1 llvm::MCStreamer::SwitchSection(llvm::MCSection*,
llvm::MCExpr const*) /home/martin/code/llvm/lib/MC/MCStreamer.cpp:997:0
#13 0x00007fd5faf998a8 llvm::WinException::endFunction(llvm::MachineFunction
const*) /home/martin/code/llvm/lib/CodeGen/AsmPrinter/WinException.cpp:147:0
#14 0x00007fd5faecb001 llvm::AsmPrinter::EmitFunctionBody()
/home/martin/code/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:1206:0
#15 0x00007fd6022a3f04
llvm::X86AsmPrinter::runOnMachineFunction(llvm::MachineFunction&)
/home/martin/code/llvm/lib/Target/X86/X86AsmPrinter.cpp:81:0
#16 0x00007fd6009ad830
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
/home/martin/code/llvm/lib/CodeGen/MachineFunctionPass.cpp:61:0
#17 0x00007fd5ffe5d7b2 llvm::FPPassManager::runOnFunction(llvm::Function&)
/home/martin/code/llvm/lib/IR/LegacyPassManager.cpp:1585:0
#18 0x00007fd5ffe5d967 llvm::FPPassManager::runOnModule(llvm::Module&)
/home/martin/code/llvm/lib/IR/LegacyPassManager.cpp:1607:0
#19 0x00007fd5ffe5dd05 (anonymous
namespace)::MPPassManager::runOnModule(llvm::Module&)
/home/martin/code/llvm/lib/IR/LegacyPassManager.cpp:1664:0
#20 0x00007fd5ffe5e46a llvm::legacy::PassManagerImpl::run(llvm::Module&)
/home/martin/code/llvm/lib/IR/LegacyPassManager.cpp:1768:0
#21 0x00007fd5ffe5e6ad llvm::legacy::PassManager::run(llvm::Module&)
/home/martin/code/llvm/lib/IR/LegacyPassManager.cpp:1800:0
#22 0x00007fd5fc472876 (anonymous
namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
/home/martin/code/llvm/tools/clang/lib/CodeGen/BackendUtil.cpp:842:0
#23 0x00007fd5fc475a28 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout
const&, llvm::Module*, clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
/home/martin/code/llvm/tools/clang/lib/CodeGen/BackendUtil.cpp:1265:0
#24 0x00007fd5fc877af7
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
/home/martin/code/llvm/tools/clang/lib/CodeGen/CodeGenAction.cpp:294:0
#25 0x00007fd5f74182f8 clang::ParseAST(clang::Sema&, bool, bool)
/home/martin/code/llvm/tools/clang/lib/Parse/ParseAST.cpp:177:0
#26 0x00007fd5fbcc4b15 clang::ASTFrontendAction::ExecuteAction()
/home/martin/code/llvm/tools/clang/lib/Frontend/FrontendAction.cpp:1012:0
#27 0x00007fd5fc8743c2 clang::CodeGenAction::ExecuteAction()
/home/martin/code/llvm/tools/clang/lib/CodeGen/CodeGenAction.cpp:1044:0
#28 0x00007fd5fbcc4516 clang::FrontendAction::Execute()
/home/martin/code/llvm/tools/clang/lib/Frontend/FrontendAction.cpp:914:0
#29 0x00007fd5fbc3cbb2
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/home/martin/code/llvm/tools/clang/lib/Frontend/CompilerInstance.cpp:962:0
#30 0x00007fd5fb907b8d
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/home/martin/code/llvm/tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:257:0
#31 0x0000000000455c94 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) /home/martin/code/llvm/tools/clang/tools/driver/cc1_main.cpp:216:0
#32 0x000000000044affc ExecuteCC1Tool(llvm::ArrayRef<char const*>,
llvm::StringRef)
/home/martin/code/llvm/tools/clang/tools/driver/driver.cpp:310:0
#33 0x000000000044bd41 main
/home/martin/code/llvm/tools/clang/tools/driver/driver.cpp:382:0



This didn't crash before that commit, and I presume it also worked before the
old change in SVN r268331 ([MC] Create unique .pdata sections for every .text
section).

-- 
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/20180720/9ba6a5e2/attachment-0001.html>


More information about the llvm-bugs mailing list