[llvm-bugs] [Bug 33960] New: crash at -O3 in both 32-bit and 64-bit modes on x86_64-linux-gnu (Assertion `(InMaskOpc == ISD::SETCC || ISD::isBuildVectorOfConstantSDNodes(InMask.getNode()) || (isLogicalMaskOp(InMaskOpc) && isSETCCorConvertedSETCC(InMask->getOperand(0)) && isSETCCorCon

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jul 26 23:59:02 PDT 2017


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

            Bug ID: 33960
           Summary: crash at -O3 in both 32-bit and 64-bit modes on
                    x86_64-linux-gnu (Assertion `(InMaskOpc == ISD::SETCC
                    ||
                    ISD::isBuildVectorOfConstantSDNodes(InMask.getNode())
                    || (isLogicalMaskOp(InMaskOpc) &&
                    isSETCCorConvertedSETCC(InMask->getOperand(0)) &&
                    isSETCCorCon
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: chengniansun at gmail.com
                CC: llvm-bugs at lists.llvm.org

$ clang-trunk -v
clang version 6.0.0 (trunk 309126)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/i686-linux-gnu/5
Found candidate GCC installation: /usr/bin/../lib/gcc/i686-linux-gnu/5.3.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9.3
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.3.0
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$ 
$ clang-trunk -O3 small.c
clang-6.0:
/tmp/llvm-builder/llvm-source-trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp:2988:
llvm::SDValue llvm::DAGTypeLegalizer::convertMask(llvm::SDValue, llvm::EVT,
llvm::EVT): Assertion `(InMaskOpc == ISD::SETCC ||
ISD::isBuildVectorOfConstantSDNodes(InMask.getNode()) ||
(isLogicalMaskOp(InMaskOpc) && isSETCCorConvertedSETCC(InMask->getOperand(0))
&& isSETCCorConvertedSETCC(InMask->getOperand(1)))) && "Unexpected mask
argument."' failed.
#0 0x00000000020bb6fa llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-6.0+0x20bb6fa)
#1 0x00000000020b97ae llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-6.0+0x20b97ae)
#2 0x00000000020b9912 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-6.0+0x20b9912)
#3 0x00007f545b03d340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x00007f5459e2ecc9 gsignal
/build/eglibc-3GlaMS/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007f5459e320d8 abort
/build/eglibc-3GlaMS/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007f5459e27b86 __assert_fail_base
/build/eglibc-3GlaMS/eglibc-2.19/assert/assert.c:92:0
#7 0x00007f5459e27c32 (/lib/x86_64-linux-gnu/libc.so.6+0x2fc32)
#8 0x0000000002896998 llvm::DAGTypeLegalizer::convertMask(llvm::SDValue,
llvm::EVT, llvm::EVT) (/usr/local/clang-trunk/bin/clang-6.0+0x2896998)
#9 0x00000000028a22ad
llvm::DAGTypeLegalizer::WidenVSELECTAndMask(llvm::SDNode*)
(/usr/local/clang-trunk/bin/clang-6.0+0x28a22ad)
#10 0x00000000028d9060
llvm::DAGTypeLegalizer::PromoteIntOp_SELECT(llvm::SDNode*, unsigned int)
(/usr/local/clang-trunk/bin/clang-6.0+0x28d9060)
#11 0x00000000028f7cb5
llvm::DAGTypeLegalizer::PromoteIntegerOperand(llvm::SDNode*, unsigned int)
(/usr/local/clang-trunk/bin/clang-6.0+0x28f7cb5)
#12 0x000000000287cb66 llvm::DAGTypeLegalizer::run()
(/usr/local/clang-trunk/bin/clang-6.0+0x287cb66)
#13 0x000000000287d3ba llvm::SelectionDAG::LegalizeTypes()
(/usr/local/clang-trunk/bin/clang-6.0+0x287d3ba)
#14 0x0000000002842ce1 llvm::SelectionDAGISel::CodeGenAndEmitDAG()
(/usr/local/clang-trunk/bin/clang-6.0+0x2842ce1)
#15 0x0000000002843c46
llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction,
true, false, void>, false, true>,
llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction, true,
false, void>, false, true>, bool&)
(/usr/local/clang-trunk/bin/clang-6.0+0x2843c46)
#16 0x000000000284b8f3
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&)
(/usr/local/clang-trunk/bin/clang-6.0+0x284b8f3)
#17 0x000000000284dd47
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) [clone
.part.1069] (/usr/local/clang-trunk/bin/clang-6.0+0x284dd47)
#18 0x0000000001549ca4 (anonymous
namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(/usr/local/clang-trunk/bin/clang-6.0+0x1549ca4)
#19 0x000000000197f5b5
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-6.0+0x197f5b5)
#20 0x0000000001c76393 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-6.0+0x1c76393)
#21 0x0000000001c7643c llvm::FPPassManager::runOnModule(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-6.0+0x1c7643c)
#22 0x0000000001c7718f llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-6.0+0x1c7718f)
#23 0x00000000022393ee (anonymous
namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/usr/local/clang-trunk/bin/clang-6.0+0x22393ee)
#24 0x000000000223a6d1 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> >)
(/usr/local/clang-trunk/bin/clang-6.0+0x223a6d1)
#25 0x00000000029068ab
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/usr/local/clang-trunk/bin/clang-6.0+0x29068ab)
#26 0x0000000002d057f2 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-6.0+0x2d057f2)
#27 0x0000000002905f4f clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-6.0+0x2905f4f)
#28 0x00000000025c8bf6 clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-6.0+0x25c8bf6)
#29 0x00000000025a095e
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-6.0+0x25a095e)
#30 0x00000000026578fb
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-6.0+0x26578fb)
#31 0x0000000000b723f8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-6.0+0xb723f8)
#32 0x0000000000b0e962 main (/usr/local/clang-trunk/bin/clang-6.0+0xb0e962)
#33 0x00007f5459e19ec5 __libc_start_main
/build/eglibc-3GlaMS/eglibc-2.19/csu/libc-start.c:321:0
#34 0x0000000000b6da79 _start (/usr/local/clang-trunk/bin/clang-6.0+0xb6da79)
Stack dump:
0.      Program arguments: /usr/local/clang-trunk/bin/clang-6.0 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name small.c
-mrelocation-model static -mthread-model posix -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64
-momit-leaf-frame-pointer -dwarf-column-info -debugger-tuning=gdb -resource-dir
/usr/local/clang-trunk/lib/clang/6.0.0 -c-isystem . -c-isystem
/usr/local/include/csmith -c-isystem /usr/local/include/csmith
-internal-isystem /usr/local/include -internal-isystem
/usr/local/clang-trunk/lib/clang/6.0.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -O3 -fdebug-compilation-dir
/home/cnsun/ramdisk/hermes/run-6/res/20170711-clang-trunk-m32-Weverything-g-O3-build-084238/delta-perses
-ferror-limit 19 -fmessage-length 132 -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp
-o /tmp/small-38a122.o -x c small.c 
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'small.c'.
4.      Running pass 'X86 DAG->DAG Instruction Selection' on function '@main'
clang-6.0: error: unable to execute command: Aborted (core dumped)
clang-6.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 6.0.0 (trunk 309126)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang-6.0: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and
associated run script.
clang-6.0: note: diagnostic msg: 
********************

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

********************
$ 
$ cat small.c
int a, b, c;
short fn1(short p1, short p2) { return p2 == 0 ? p1 : p1 / p2; }

int main() {
  short d, e;
  c = 0;
  for (; c != 25; c++) {
    e = fn1(-7, c);
    { d = e || e >> a ? e : a; }
    b |= d;
  }
  return 0;
}
$

-- 
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/20170727/8e794072/attachment-0001.html>


More information about the llvm-bugs mailing list