[llvm-bugs] [Bug 28946] New: crash at -O3 in both 32-bit and 64-bit modes on x86_64-linux-gnu (Assertion `(KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"' failed.)

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 11 22:16:33 PDT 2016


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

            Bug ID: 28946
           Summary: crash at -O3 in both 32-bit and 64-bit modes on
                    x86_64-linux-gnu (Assertion `(KnownZero & KnownOne) ==
                    0 && "Bits known to be one AND zero?"' failed.)
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            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-3.8 does not crash. 

$ clang-trunk -v
clang version 4.0.0 (trunk 278347)
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 -w small.c
clang-4.0:
/tmp/llvm-builder/llvm-source-trunk/lib/Analysis/ValueTracking.cpp:1564: void
computeKnownBits(llvm::Value*, llvm::APInt&, llvm::APInt&, unsigned int, const
{anonymous}::Query&): Assertion `(KnownZero & KnownOne) == 0 && "Bits known to
be one AND zero?"' failed.
#0 0x0000000001c24985 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-4.0+0x1c24985)
#1 0x0000000001c228ee llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-4.0+0x1c228ee)
#2 0x0000000001c22a52 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-4.0+0x1c22a52)
#3 0x00007f7f1d9e3330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#4 0x00007f7f1c7d4c37 gsignal
/build/eglibc-oGUzwX/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007f7f1c7d8028 abort
/build/eglibc-oGUzwX/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007f7f1c7cdbf6 __assert_fail_base
/build/eglibc-oGUzwX/eglibc-2.19/assert/assert.c:92:0
#7 0x00007f7f1c7cdca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#8 0x0000000001543c3f computeKnownBits(llvm::Value*, llvm::APInt&,
llvm::APInt&, unsigned int, (anonymous namespace)::Query const&)
(/usr/local/clang-trunk/bin/clang-4.0+0x1543c3f)
#9 0x00000000015472b4 llvm::computeKnownBits(llvm::Value*, llvm::APInt&,
llvm::APInt&, llvm::DataLayout const&, unsigned int, llvm::AssumptionCache*,
llvm::Instruction const*, llvm::DominatorTree const*)
(/usr/local/clang-trunk/bin/clang-4.0+0x15472b4)
#10 0x0000000001957a91 llvm::InstCombiner::run()
(/usr/local/clang-trunk/bin/clang-4.0+0x1957a91)
#11 0x00000000019585f9 combineInstructionsOverFunction(llvm::Function&,
llvm::InstCombineWorklist&, llvm::AAResults*, llvm::AssumptionCache&,
llvm::TargetLibraryInfo&, llvm::DominatorTree&, bool, llvm::LoopInfo*)
(/usr/local/clang-trunk/bin/clang-4.0+0x19585f9)
#12 0x00000000019589ee
llvm::InstructionCombiningPass::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-4.0+0x19589ee)
#13 0x00000000018a7263 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-4.0+0x18a7263)
#14 0x00000000018a72fb llvm::FPPassManager::runOnModule(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-4.0+0x18a72fb)
#15 0x00000000018a78ff llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-4.0+0x18a78ff)
#16 0x0000000001d7dad0 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
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-4.0+0x1d7dad0)
#17 0x0000000002373378
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/usr/local/clang-trunk/bin/clang-4.0+0x2373378)
#18 0x00000000026c5d6b clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x26c5d6b)
#19 0x000000000237376e clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-4.0+0x237376e)
#20 0x0000000002090ad6 clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-4.0+0x2090ad6)
#21 0x000000000206bade
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-4.0+0x206bade)
#22 0x00000000021165d6
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-4.0+0x21165d6)
#23 0x0000000000a53078 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-4.0+0xa53078)
#24 0x00000000009fdc7f main (/usr/local/clang-trunk/bin/clang-4.0+0x9fdc7f)
#25 0x00007f7f1c7bff45 __libc_start_main
/build/eglibc-oGUzwX/eglibc-2.19/csu/libc-start.c:321:0
#26 0x0000000000a4ef2d _start (/usr/local/clang-trunk/bin/clang-4.0+0xa4ef2d)
Stack dump:
0.      Program arguments: /usr/local/clang-trunk/bin/clang-4.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/bin/../lib/clang/4.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/bin/../lib/clang/4.0.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -O3 -w -fdebug-compilation-dir
/home/cnsun/ramdisk/hermes/run-1/res/20160811-clang-trunk-m64-g-O3-build-142550/delta
-ferror-limit 19 -fmessage-length 118 -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp
-o /tmp/small-62f90c.o -x c small.c
1.      <eof> parser at end of file
2.      Per-module optimization passes
3.      Running pass 'Function Pass Manager' on module 'small.c'.
4.      Running pass 'Combine redundant instructions' on function '@main'
clang-4.0: error: unable to execute command: Aborted (core dumped)
clang-4.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 4.0.0 (trunk 278347)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-4.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-4.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-4.0: note: diagnostic msg: /tmp/small-8e8c67.c
clang-4.0: note: diagnostic msg: /tmp/small-8e8c67.sh
clang-4.0: note: diagnostic msg:

********************
$ cat small.c
static int a = 10992;
int main() {
  5 - a *((4 || 3) << 18) / 5 << 0;
  a = 8737;
  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/20160812/7bc67031/attachment.html>


More information about the llvm-bugs mailing list