[llvm-bugs] [Bug 32128] New: crash at -O3 -m32 on x86_64-linux-gnu (Assertion `(isConstantOrConstantVector(NewCF) || isConstantFPBuildVectorOrConstantFP(NewCF)) && "Failed to constant fold a binop with constant operands"' )

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Mar 3 08:24:37 PST 2017


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

            Bug ID: 32128
           Summary: crash at -O3 -m32 on x86_64-linux-gnu (Assertion
                    `(isConstantOrConstantVector(NewCF) ||
                    isConstantFPBuildVectorOrConstantFP(NewCF)) && "Failed
                    to constant fold a binop with constant operands"' )
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            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 5.0.0 (trunk 296754)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
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.2
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/lib/gcc/x86_64-linux-gnu/4.8
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$ clang-trunk -O3 -m32 small.c
clang-5.0:
/tmp/llvm-builder/llvm-source-trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1799:
llvm::SDValue {anonymous}::DAGCombiner::foldBinOpIntoSelect(llvm::SDNode*):
Assertion `(isConstantOrConstantVector(NewCF) ||
isConstantFPBuildVectorOrConstantFP(NewCF)) && "Failed to constant fold a binop
with constant operands"' failed.
#0 0x0000000001ee656a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-5.0+0x1ee656a)
#1 0x0000000001ee458e llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-5.0+0x1ee458e)
#2 0x0000000001ee46f2 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-5.0+0x1ee46f2)
#3 0x00007f3e4921b330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#4 0x00007f3e4800cc37 gsignal
/build/eglibc-oGUzwX/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007f3e48010028 abort
/build/eglibc-oGUzwX/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007f3e48005bf6 __assert_fail_base
/build/eglibc-oGUzwX/eglibc-2.19/assert/assert.c:92:0
#7 0x00007f3e48005ca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#8 0x0000000002509830 (anonymous
namespace)::DAGCombiner::foldBinOpIntoSelect(llvm::SDNode*) [clone .isra.564]
(/usr/local/clang-trunk/bin/clang-5.0+0x2509830)
#9 0x0000000002516ccf (anonymous
namespace)::DAGCombiner::visitMUL(llvm::SDNode*)
(/usr/local/clang-trunk/bin/clang-5.0+0x2516ccf)
#10 0x00000000025571f1 (anonymous
namespace)::DAGCombiner::combine(llvm::SDNode*)
(/usr/local/clang-trunk/bin/clang-5.0+0x25571f1)
#11 0x0000000002558f30 llvm::SelectionDAG::Combine(llvm::CombineLevel,
llvm::AAResults&, llvm::CodeGenOpt::Level)
(/usr/local/clang-trunk/bin/clang-5.0+0x2558f30)
#12 0x0000000002612f8c llvm::SelectionDAGISel::CodeGenAndEmitDAG()
(/usr/local/clang-trunk/bin/clang-5.0+0x2612f8c)
#13 0x000000000261b3f3
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&)
(/usr/local/clang-trunk/bin/clang-5.0+0x261b3f3)
#14 0x000000000261d32c
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) [clone
.part.962] (/usr/local/clang-trunk/bin/clang-5.0+0x261d32c)
#15 0x0000000001433294 (anonymous
namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(/usr/local/clang-trunk/bin/clang-5.0+0x1433294)
#16 0x0000000001816f63
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-5.0+0x1816f63)
#17 0x0000000001ad8843 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-5.0+0x1ad8843)
#18 0x0000000001ad88ec llvm::FPPassManager::runOnModule(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-5.0+0x1ad88ec)
#19 0x0000000001ad912f llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-5.0+0x1ad912f)
#20 0x000000000206e84a (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-5.0+0x206e84a)
#21 0x000000000206faf3 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-5.0+0x206faf3)
#22 0x00000000026d178c
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/usr/local/clang-trunk/bin/clang-5.0+0x26d178c)
#23 0x0000000002a979f2 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-5.0+0x2a979f2)
#24 0x00000000026d012a clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-5.0+0x26d012a)
#25 0x00000000023b5226 clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-5.0+0x23b5226)
#26 0x000000000238f8f6
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-5.0+0x238f8f6)
#27 0x0000000002440bb4
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-5.0+0x2440bb4)
#28 0x0000000000b20ee8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-5.0+0xb20ee8)
#29 0x0000000000ac28fa main (/usr/local/clang-trunk/bin/clang-5.0+0xac28fa)
#30 0x00007f3e47ff7f45 __libc_start_main
/build/eglibc-oGUzwX/eglibc-2.19/csu/libc-start.c:321:0
#31 0x0000000000b1c7d9 _start (/usr/local/clang-trunk/bin/clang-5.0+0xb1c7d9)
Stack dump:
0.      Program arguments: /usr/local/clang-trunk/bin/clang-5.0 -cc1 -triple
i386-unknown-linux-gnu -emit-obj -disable-free -main-file-name small.c
-mrelocation-model static -mthread-model posix -fmath-errno -masm-verbose
-mconstructor-aliases -fuse-init-array -target-cpu pentium4
-momit-leaf-frame-pointer -dwarf-column-info -debugger-tuning=gdb -resource-dir
/usr/local/clang-trunk/lib/clang/5.0.0 -c-isystem . -c-isystem
/usr/local/include/csmith-2.2.0/ -c-isystem /usr/local/include/csmith-2.2.0/
-internal-isystem /usr/local/include -internal-isystem
/usr/local/clang-trunk/lib/clang/5.0.0/include -internal-externc-isystem
/include -internal-externc-isystem /usr/include -O3 -fdebug-compilation-dir
/home/cnsun/ramdisk/hermes/run-7/res/20170302-clang-trunk-m32-Weverything-g-O3-build-181833/delta
-ferror-limit 19 -fmessage-length 261 -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp
-o /tmp/small-19c14b.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-5.0: error: unable to execute command: Aborted (core dumped)
clang-5.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 5.0.0 (trunk 296754)
Target: i386-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-5.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-5.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-5.0: note: diagnostic msg: /tmp/small-c920a3.c
clang-5.0: note: diagnostic msg: /tmp/small-c920a3.sh
clang-5.0: note: diagnostic msg: 

********************
$ 
$ cat small.c
int printf(const char*, ...);
unsigned a;
static long long b = 50408888378;
int main() {
  int i = 0;
  for (; i < 2; i++) {
    int c = b;
    a = 7 * b;
    if (c)
      printf("%llu", (long long)a);
  }
  b = 1;
  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/20170303/d7432e4e/attachment.html>


More information about the llvm-bugs mailing list