[llvm-bugs] [Bug 46721] New: optimizer segfault on IR input

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jul 15 02:04:22 PDT 2020


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

            Bug ID: 46721
           Summary: optimizer segfault on IR input
           Product: tools
           Version: 10.0
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: opt
          Assignee: unassignedbugs at nondot.org
          Reporter: llvmbug at dworkin.nl
                CC: llvm-bugs at lists.llvm.org

Created attachment 23725
  --> https://bugs.llvm.org/attachment.cgi?id=23725&action=edit
IR

# Command

clang -O test.ll

Reproduced on Ubuntu 20.04 and macOS (clang-1100.0.33.17).  Without -O there is
no crash.


# test.ll (also as attachment)

target triple = "x86_64-pc-linux-gnu"

define void @func(i8* %f) #1 {
L002a:
        %l1 = xor i64 0, 0
        switch i64 %l1, label %L00d4 [
                i64 1, label %L0045
                i64 4, label %L00d4
                i64 6, label %L00d4
        ]
L0045:
        switch i64 %l1, label %L00d4 [
                i64 3, label %L0061
        ]
L0061:
        %l2 = xor i64 2, 0
        br label %L00d4
L00d4:
        %l3 = phi i64 [%l1, %L002a], [%l1, %L0045], [%l2, %L0061]
        ret void
}


# Output

Stack dump:
0.      Program arguments: /usr/lib/llvm-10/bin/clang -cc1 -triple
x86_64-pc-linux-gnu -emit-obj -disable-free -disable-llvm-verifier
-discard-value-names -main-file-name fa0ef47025935b0946f06abdbee5ab06.ll
-mrelocation-model pic -pic-level 2 -mthread-model posix -mframe-pointer=none
-fmath-errno -fno-rounding-math -masm-verbose -mconstructor-aliases
-munwind-tables -target-cpu znver2 -target-feature +sse2 -target-feature +cx16
-target-feature +sahf -target-feature -tbm -target-feature -avx512ifma
-target-feature +sha -target-feature -gfni -target-feature -fma4
-target-feature -vpclmulqdq -target-feature +prfchw -target-feature +bmi2
-target-feature -cldemote -target-feature +fsgsbase -target-feature -ptwrite
-target-feature +xsavec -target-feature +popcnt -target-feature +aes
-target-feature -avx512bitalg -target-feature -movdiri -target-feature +xsaves
-target-feature -avx512er -target-feature -avx512vnni -target-feature
-avx512vpopcntdq -target-feature -pconfig -target-feature +clwb -target-feature
-avx512f -target-feature +clzero -target-feature -pku -target-feature +mmx
-target-feature -lwp -target-feature +rdpid -target-feature -xop
-target-feature +rdseed -target-feature -waitpkg -target-feature -movdir64b
-target-feature +sse4a -target-feature -avx512bw -target-feature +clflushopt
-target-feature +xsave -target-feature -avx512vbmi2 -target-feature +64bit
-target-feature -avx512vl -target-feature -invpcid -target-feature -avx512cd
-target-feature +avx -target-feature -vaes -target-feature +cx8 -target-feature
+fma -target-feature -rtm -target-feature +bmi -target-feature -enqcmd
-target-feature +rdrnd -target-feature +mwaitx -target-feature +sse4.1
-target-feature +sse4.2 -target-feature +avx2 -target-feature +fxsr
-target-feature +wbnoinvd -target-feature +sse -target-feature +lzcnt
-target-feature +pclmul -target-feature -prefetchwt1 -target-feature +f16c
-target-feature +ssse3 -target-feature -sgx -target-feature -shstk
-target-feature +cmov -target-feature -avx512vbmi -target-feature -avx512bf16
-target-feature +movbe -target-feature +xsaveopt -target-feature -avx512dq
-target-feature +adx -target-feature -avx512pf -target-feature +sse3
-dwarf-column-info -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir
/usr/lib/llvm-10/lib/clang/10.0.0 -Os -fdebug-compilation-dir
/home/felix/d/lpc-ext/jit -ferror-limit 19 -fmessage-length 80
-fgnuc-version=4.2.1 -fobjc-runtime=gcc -fdiagnostics-show-option
-fcolor-diagnostics -vectorize-loops -vectorize-slp -faddrsig -o
/tmp/fa0ef47025935b0946f06abdbee5ab06-005afc.o -x ir
cache/fa/fa0ef47025935b0946f06abdbee5ab06.ll 
1.      Per-function optimization
2.      Running pass 'Simplify the CFG' on function '@func11'
 #0 0x00007ffff17d14ff llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/lib/x86_64-linux-gnu/libLLVM-10.so.1+0x9814ff)
 #1 0x00007ffff17cf7b0 llvm::sys::RunSignalHandlers()
(/lib/x86_64-linux-gnu/libLLVM-10.so.1+0x97f7b0)
 #2 0x00007ffff17d1ac5 (/lib/x86_64-linux-gnu/libLLVM-10.so.1+0x981ac5)
 #3 0x00007ffff7fa13c0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
 #4 0x00007ffff18b70c6 llvm::PHINode::removeIncomingValue(unsigned int, bool)
(/lib/x86_64-linux-gnu/libLLVM-10.so.1+0xa670c6)
 #5 0x00007ffff201ef3f (/lib/x86_64-linux-gnu/libLLVM-10.so.1+0x11cef3f)
 #6 0x00007ffff2017152 (/lib/x86_64-linux-gnu/libLLVM-10.so.1+0x11c7152)
 #7 0x00007ffff2013a70 llvm::simplifyCFG(llvm::BasicBlock*,
llvm::TargetTransformInfo const&, llvm::SimplifyCFGOptions const&,
llvm::SmallPtrSetImpl<llvm::BasicBlock*>*)
(/lib/x86_64-linux-gnu/libLLVM-10.so.1+0x11c3a70)
 #8 0x00007ffff2334efd (/lib/x86_64-linux-gnu/libLLVM-10.so.1+0x14e4efd)
 #9 0x00007ffff2334907 (/lib/x86_64-linux-gnu/libLLVM-10.so.1+0x14e4907)
#10 0x00007ffff18d6d76 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/lib/x86_64-linux-gnu/libLLVM-10.so.1+0xa86d76)
#11 0x00007ffff18d649e
llvm::legacy::FunctionPassManagerImpl::run(llvm::Function&)
(/lib/x86_64-linux-gnu/libLLVM-10.so.1+0xa8649e)
#12 0x00007ffff18d6436 llvm::legacy::FunctionPassManager::run(llvm::Function&)
(/lib/x86_64-linux-gnu/libLLVM-10.so.1+0xa86436)
#13 0x00007ffff68cc31b 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> >)
(/lib/x86_64-linux-gnu/libclang-cpp.so.10+0x13e831b)
#14 0x00007ffff6b49245 clang::CodeGenAction::ExecuteAction()
(/lib/x86_64-linux-gnu/libclang-cpp.so.10+0x1665245)
#15 0x00007ffff71afe58 clang::FrontendAction::Execute()
(/lib/x86_64-linux-gnu/libclang-cpp.so.10+0x1ccbe58)
#16 0x00007ffff71688a1
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/lib/x86_64-linux-gnu/libclang-cpp.so.10+0x1c848a1)
#17 0x00007ffff7213daf
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/lib/x86_64-linux-gnu/libclang-cpp.so.10+0x1d2fdaf)
#18 0x000000000041229d cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/lib/llvm-10/bin/clang+0x41229d)
#19 0x00000000004105b1 (/usr/lib/llvm-10/bin/clang+0x4105b1)
#20 0x000000000041036d main (/usr/lib/llvm-10/bin/clang+0x41036d)
#21 0x00007ffff09380b3 __libc_start_main
/build/glibc-YYA7BZ/glibc-2.31/csu/../csu/libc-start.c:342:3
#22 0x000000000040d7ce _start (/usr/lib/llvm-10/bin/clang+0x40d7ce)
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 10.0.0-4ubuntu1 
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /bin
clang: note: diagnostic msg: PLEASE submit a bug report to
https://bugs.llvm.org/ and include the crash backtrace, preprocessed source,
and associated run script.
clang: note: diagnostic msg: Error generating preprocessed source(s) - no
preprocessable inputs.

-- 
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/20200715/773845de/attachment-0001.html>


More information about the llvm-bugs mailing list