[llvm-bugs] [Bug 51697] New: clang-13 regression: crash if compile with -fsave-optimization-record=bitstream

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Aug 31 19:57:03 PDT 2021


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

            Bug ID: 51697
           Summary: clang-13 regression: crash if compile with
                    -fsave-optimization-record=bitstream
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: npickito at gmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

= Symptom

clang will crash on compile any program with
-fsave-optimization-record=bitstream.

= Version

Both llvm 13 branch and main branch will crash

$ clang -v
clang version 13.0.0 (git at github.com:llvm/llvm-project.git
0ec5fc44ee05ea47e353e6a7eb5c2acc84004515)
Target: x86_64-unknown-linux-gnu
Thread model: posix

$ clang -v
clang version 14.0.0 (git at github.com:llvm/llvm-project.git
c1184ca6eb97e0ac5f7b6cdcc99e3905d27f9d95)
Target: x86_64-unknown-linux-gnu
Thread model: posix


= How to reproduce 
$ cat x.c
int foo(){return 0;}

$ clang x.c -fsave-optimization-record=bitstream -target x86_64-linux-gnu

= error message

0.      Program arguments: /scratch1/kitoc/llvm-workspace/build/bin/clang-13
-cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all
--mrelax-relocations -disable-free -main-file-name x.c -mrelocation-model
static -mframe-pointer=all -fmath-errno -fno-rounding-math
-mconstructor-aliases -munwind-tables -target-cpu x86-64 -tune-cpu generic
-debug-info-kind=line-tables-only -debugger-tuning=gdb
-fcoverage-compilation-dir=/home/kitoc/llvm-workspace/build -resource-dir
/scratch1/kitoc/llvm-workspace/build/lib/clang/13.0.0 -internal-isystem
/scratch1/kitoc/llvm-workspace/build/lib/clang/13.0.0/include -internal-isystem
/usr/local/include -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/11/../../../../x86_64-linux-gnu/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-fdebug-compilation-dir=/home/kitoc/llvm-workspace/build -ferror-limit 19
-fgnuc-version=4.2.1 -fcolor-diagnostics -opt-record-file x.opt.bitstream
-opt-record-format bitstream -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o
/tmp/x-208687.o -x c x.c
1.      <eof> parser at end of file
2.      Code generation
 #0 0x0000557c35c91a02 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
/home/kitoc/llvm-workspace/llvm-project/llvm/lib/Support/Unix/Signals.inc:565:0
 #1 0x0000557c35c91ab9 PrintStackTraceSignalHandler(void*)
/home/kitoc/llvm-workspace/llvm-project/llvm/lib/Support/Unix/Signals.inc:632:0
 #2 0x0000557c35c8f76d llvm::sys::RunSignalHandlers()
/home/kitoc/llvm-workspace/llvm-project/llvm/lib/Support/Signals.cpp:97:0
 #3 0x0000557c35c91383 SignalHandler(int)
/home/kitoc/llvm-workspace/llvm-project/llvm/lib/Support/Unix/Signals.inc:407:0
 #4 0x00007f5a971e2980 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12980)
 #5 0x00007f5a95e0ffb7 raise
/build/glibc-S9d2JN/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
 #6 0x00007f5a95e11921 abort /build/glibc-S9d2JN/glibc-2.27/stdlib/abort.c:81:0
 #7 0x00007f5a95e0148a __assert_fail_base
/build/glibc-S9d2JN/glibc-2.27/assert/assert.c:89:0
 #8 0x00007f5a95e01502 (/lib/x86_64-linux-gnu/libc.so.6+0x30502)
 #9 0x0000557c3574efd2 llvm::MCStreamer::SwitchSection(llvm::MCSection*,
llvm::MCExpr const*)
/home/kitoc/llvm-workspace/llvm-project/llvm/lib/MC/MCStreamer.cpp:1211:0
#10 0x0000557c36f337a3
llvm::AsmPrinter::emitRemarksSection(llvm::remarks::RemarkStreamer&)
/home/kitoc/llvm-workspace/llvm-project/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:1710:0
#11 0x0000557c36f33bc9 llvm::AsmPrinter::doFinalization(llvm::Module&)
/home/kitoc/llvm-workspace/llvm-project/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:1771:0
#12 0x0000557c350dc3ff llvm::FPPassManager::doFinalization(llvm::Module&)
/home/kitoc/llvm-workspace/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1503:0
#13 0x0000557c350dc9a4 (anonymous
namespace)::MPPassManager::runOnModule(llvm::Module&)
/home/kitoc/llvm-workspace/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1590:0
#14 0x0000557c350d77f9 llvm::legacy::PassManagerImpl::run(llvm::Module&)
/home/kitoc/llvm-workspace/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:542:0
#15 0x0000557c350dcfc3 llvm::legacy::PassManager::run(llvm::Module&)
/home/kitoc/llvm-workspace/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1682:0
#16 0x0000557c360d462f (anonymous
namespace)::EmitAssemblyHelper::EmitAssemblyWithNewPassManager(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
/home/kitoc/llvm-workspace/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:1499:0
#17 0x0000557c360d57ee clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef,
llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
/home/kitoc/llvm-workspace/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:1660:0
#18 0x0000557c374235be
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
/home/kitoc/llvm-workspace/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:334:0
#19 0x0000557c38f076b2 clang::ParseAST(clang::Sema&, bool, bool)
/home/kitoc/llvm-workspace/llvm-project/clang/lib/Parse/ParseAST.cpp:178:0
#20 0x0000557c36a34fa1 clang::ASTFrontendAction::ExecuteAction()
/home/kitoc/llvm-workspace/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1058:0
#21 0x0000557c3741ffc4 clang::CodeGenAction::ExecuteAction()
/home/kitoc/llvm-workspace/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:1045:0
#22 0x0000557c36a3486a clang::FrontendAction::Execute()
/home/kitoc/llvm-workspace/llvm-project/clang/lib/Frontend/FrontendAction.cpp:955:0
#23 0x0000557c369729a2
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/home/kitoc/llvm-workspace/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:974:0
#24 0x0000557c36bcba20
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/home/kitoc/llvm-workspace/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:278:0
#25 0x0000557c329d6068 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*)
/home/kitoc/llvm-workspace/llvm-project/clang/tools/driver/cc1_main.cpp:246:0
#26 0x0000557c329ca960 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
/home/kitoc/llvm-workspace/llvm-project/clang/tools/driver/driver.cpp:338:0
#27 0x0000557c329cb02d main
/home/kitoc/llvm-workspace/llvm-project/clang/tools/driver/driver.cpp:409:0
#28 0x00007f5a95df2bf7 __libc_start_main
/build/glibc-S9d2JN/glibc-2.27/csu/../csu/libc-start.c:344:0
#29 0x0000557c329c8f8a _start
(/scratch1/kitoc/llvm-workspace/build/bin/clang-13+0x3256f8a)
clang-13: error: unable to execute command: Aborted (core dumped)
clang-13: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 13.0.0 (git at github.com:llvm/llvm-project.git
0ec5fc44ee05ea47e353e6a7eb5c2acc84004515)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/kitoc/llvm-workspace/build/bin
clang-13: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-13: note: diagnostic msg: /tmp/x-ff6112.c
clang-13: note: diagnostic msg: /tmp/x-ff6112.sh
clang-13: note: diagnostic msg: 

********************

-- 
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/20210901/3f71421a/attachment-0001.html>


More information about the llvm-bugs mailing list