[llvm-bugs] [Bug 28534] New: crash at -O3 in both 32-bit and 64-bit modes on x86_64-linux-gnu (Assertion `(CaseConst == TrueConst || CaseConst == FalseConst) && "Expect true or false as compare result."' failed)

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jul 13 01:57:35 PDT 2016


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

            Bug ID: 28534
           Summary: crash at -O3 in both 32-bit and 64-bit modes on
                    x86_64-linux-gnu (Assertion `(CaseConst == TrueConst
                    || CaseConst == FalseConst) && "Expect true or false
                    as compare result."' failed)
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: chengniansun at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

$ clang-trunk -v
clang version 3.9.0 (trunk 272931)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
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.3.0
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.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-3.9:
/tmp/llvm-builder/llvm-source-trunk/lib/Transforms/Utils/SimplifyCFG.cpp:4752:
void reuseTableCompare(llvm::User*, llvm::BasicBlock*, llvm::BranchInst*,
llvm::Constant*, const llvm::SmallVectorImpl<std::pair<llvm::ConstantInt*,
llvm::Constant*> >&): Assertion `(CaseConst == TrueConst || CaseConst ==
FalseConst) && "Expect true or false as compare result."' failed.
#0 0x0000000001b5b845 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-3.9+0x1b5b845)
#1 0x0000000001b594a6 llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-3.9+0x1b594a6)
#2 0x0000000001b596d1 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-3.9+0x1b596d1)
#3 0x00007f47b91a7340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x00007f47b83c5cc9 gsignal
/build/eglibc-3GlaMS/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007f47b83c90d8 abort
/build/eglibc-3GlaMS/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007f47b83beb86 __assert_fail_base
/build/eglibc-3GlaMS/eglibc-2.19/assert/assert.c:92:0
#7 0x00007f47b83bec32 (/lib/x86_64-linux-gnu/libc.so.6+0x2fc32)
#8 0x00000000007ea8a1 SwitchToLookupTable(llvm::SwitchInst*,
llvm::IRBuilder<llvm::ConstantFolder, llvm::IRBuilderDefaultInserter>&,
llvm::DataLayout const&, llvm::TargetTransformInfo const&)
(/usr/local/clang-trunk/bin/clang-3.9+0x7ea8a1)
#9 0x00000000007ebf20 (anonymous
namespace)::SimplifyCFGOpt::SimplifySwitch(llvm::SwitchInst*,
llvm::IRBuilder<llvm::ConstantFolder, llvm::IRBuilderDefaultInserter>&)
(/usr/local/clang-trunk/bin/clang-3.9+0x7ebf20)
#10 0x0000000001bf07ed llvm::SimplifyCFG(llvm::BasicBlock*,
llvm::TargetTransformInfo const&, unsigned int, llvm::AssumptionCache*,
llvm::SmallPtrSetImpl<llvm::BasicBlock*>*)
(/usr/local/clang-trunk/bin/clang-3.9+0x1bf07ed)
#11 0x0000000001ad239d iterativelySimplifyCFG(llvm::Function&,
llvm::TargetTransformInfo const&, llvm::AssumptionCache*, unsigned int)
(/usr/local/clang-trunk/bin/clang-3.9+0x1ad239d)
#12 0x0000000001ad32ac (anonymous
namespace)::CFGSimplifyPass::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-3.9+0x1ad32ac)
#13 0x00000000017f10b3 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-3.9+0x17f10b3)
#14 0x000000000236f2c0 (anonymous
namespace)::CGPassManager::runOnModule(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-3.9+0x236f2c0)
#15 0x00000000017f177f llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-3.9+0x17f177f)
#16 0x0000000001c979b8 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions
const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction,
llvm::raw_pwrite_stream*) (/usr/local/clang-trunk/bin/clang-3.9+0x1c979b8)
#17 0x000000000226f066
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/usr/local/clang-trunk/bin/clang-3.9+0x226f066)
#18 0x00000000025a75eb clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-3.9+0x25a75eb)
#19 0x000000000226f42e clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-3.9+0x226f42e)
#20 0x0000000001f9b466 clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-3.9+0x1f9b466)
#21 0x0000000001f76ace
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-3.9+0x1f76ace)
#22 0x000000000202035c
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-3.9+0x202035c)
#23 0x0000000000a19a68 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-3.9+0xa19a68)
#24 0x00000000009ccb57 main (/usr/local/clang-trunk/bin/clang-3.9+0x9ccb57)
#25 0x00007f47b83b0ec5 __libc_start_main
/build/eglibc-3GlaMS/eglibc-2.19/csu/libc-start.c:321:0
#26 0x0000000000a15a34 _start (/usr/local/clang-trunk/bin/clang-3.9+0xa15a34)
Stack dump:
0.    Program arguments: /usr/local/clang-trunk/bin/clang-3.9 -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/bin/../lib/clang/3.9.0 -c-isystem . -c-isystem
/usr/local/include/csmith -internal-isystem /usr/local/include
-internal-isystem /usr/local/clang-trunk/bin/../lib/clang/3.9.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/speculative-execution/run-3/res/20160710-clang-trunk-m32-g-O3-build-000425/delta
-ferror-limit 19 -fmessage-length 131 -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp
-o /tmp/small-366994.o -x c small.c 
1.    <eof> parser at end of file
2.    Per-module optimization passes
3.    Running pass 'CallGraph Pass Manager' on module 'small.c'.
4.    Running pass 'Simplify the CFG' on function '@main'
clang-3.9: error: unable to execute command: Aborted (core dumped)
clang-3.9: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.9.0 (trunk 272931)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang-3.9: 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-3.9: note: diagnostic msg: 
********************

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

********************
$ 
$ cat small.c
char a;
unsigned char b;
int c, e, g, h;
short d, f, i;
int fn1(int p1, int p2) { return p2 == 0 ?: p1 % p2; }

int fn2(int p1, int p2) { return p2 == 0 || p1 == 71 ? p1 : p1 / p2; }

static short fn3(p1) {
  for (;; c--) {
    int j;
    e = j > 6;
    if (c > p1) {
      d = 28;
      for (; d; d--)
        if (a >> (h || fn1(2, fn2(e ^ 1, c))))
          f++;
    } else
      for (; g; i--)
        ;
  }
}

static char fn4() { return fn3(b); }

int main() { return fn4(); }
$

-- 
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/20160713/1c73ac2f/attachment-0001.html>


More information about the llvm-bugs mailing list