CTSRD-CHERI / clang

DO NOT USE. Use llvm-project instead
Other
9 stars 8 forks source link

Crash when compiling jsrun #171

Closed arichardson closed 6 years ago

arichardson commented 6 years ago
/home/alr48/cheri/output/sdk/bin//../bin/cheri-unknown-freebsd-clang -O2 -pipe -O2 -DDUK_OPT_NO_ASSERTIONS=1 -DDUK_OPT_UNDERSCORE_SETJMP=1 -DDUK_OPT_DEBUG=3 -msoft-float -mabi=purecap -mllvm -cheri-no-global-bounds -cheri=128 -DDUK_OPT_FORCE_ALIGN=16 -DDUK_USE_PACKED_TVAL=1 --sysroot=/home/alr48/cheri/output/sdk/bin//../sysroot128 -I/usr/include/edit -c duktape.c -o duktape.o
Assertion failed: (Offset.getBitWidth() == DL.getPointerBaseSizeInBits(getPointerAddressSpace()) && "The offset must have exactly as many bits as our pointer."), function accumulateConstantOffset, file /exports/users/alr48/sources/llvm/lib/IR/Operator.cpp, line 39.
#0 0x0000000002c09738 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/home/alr48/cheri/output/sdk/bin/clang-6.0+0x2c09738)
#1 0x0000000002c09af6 __assert (/home/alr48/cheri/output/sdk/bin/clang-6.0+0x2c09af6)
#2 0x0000000002716b82 (/home/alr48/cheri/output/sdk/bin/clang-6.0+0x2716b82)
#3 0x0000000002b2c22e getAdjustedPtr(llvm::IRBuilder<llvm::ConstantFolder, (anonymous namespace)::IRBuilderPrefixedInserter>&, llvm::DataLayout const&, llvm::Value*, llvm::APInt, llvm::Type*, llvm::Twine) (/home/alr48/cheri/output/sdk/bin/clang-6.0+0x2b2c22e)
#4 0x0000000002b2a52e llvm::SROA::presplitLoadsAndStores(llvm::AllocaInst&, llvm::sroa::AllocaSlices&) (/home/alr48/cheri/output/sdk/bin/clang-6.0+0x2b2a52e)
#5 0x0000000002b2fe61 llvm::SROA::splitAlloca(llvm::AllocaInst&, llvm::sroa::AllocaSlices&) (/home/alr48/cheri/output/sdk/bin/clang-6.0+0x2b2fe61)
#6 0x0000000002b3149c llvm::SROA::runOnAlloca(llvm::AllocaInst&) (/home/alr48/cheri/output/sdk/bin/clang-6.0+0x2b3149c)
#7 0x0000000002b32cb7 llvm::SROA::runImpl(llvm::Function&, llvm::DominatorTree&, llvm::AssumptionCache&) (/home/alr48/cheri/output/sdk/bin/clang-6.0+0x2b32cb7)
#8 0x0000000002b4234c llvm::sroa::SROALegacyPass::runOnFunction(llvm::Function&) (/home/alr48/cheri/output/sdk/bin/clang-6.0+0x2b4234c)
#9 0x00000000026ef24a llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/alr48/cheri/output/sdk/bin/clang-6.0+0x26ef24a)
#10 0x0000000002190ae2 (anonymous namespace)::CGPassManager::runOnModule(llvm::Module&) (/home/alr48/cheri/output/sdk/bin/clang-6.0+0x2190ae2)
#11 0x00000000026efa2b llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/alr48/cheri/output/sdk/bin/clang-6.0+0x26efa2b)
#12 0x0000000002d8abe4 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout const&, clang::LangOptions const&::Module*, clang::BackendAction, std::__1::unique_ptr<clang::LangOptions const&::raw_pwrite_stream, clang::BackendAction::default_delete<std::__1::unique_ptr> >) (/home/alr48/cheri/output/sdk/bin/clang-6.0+0x2d8abe4)
#13 0x000000000329157b clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/home/alr48/cheri/output/sdk/bin/clang-6.0+0x329157b)
#14 0x0000000003917552 clang::ParseAST(clang::Sema&, bool, bool) (/home/alr48/cheri/output/sdk/bin/clang-6.0+0x3917552)
#15 0x000000000320646c clang::FrontendAction::Execute(void) (/home/alr48/cheri/output/sdk/bin/clang-6.0+0x320646c)
#16 0x0000000003198121 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/alr48/cheri/output/sdk/bin/clang-6.0+0x3198121)
#17 0x000000000328b935 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/alr48/cheri/output/sdk/bin/clang-6.0+0x328b935)
#18 0x000000000161fd96 char const* cc1_main(llvm::ArrayRef<char const*>(void*) (/home/alr48/cheri/output/sdk/bin/clang-6.0+0x161fd96)
#19 0x000000000161dd9e main (/home/alr48/cheri/output/sdk/bin/clang-6.0+0x161dd9e)
#20 0x000000000161b17f _start (/home/alr48/cheri/output/sdk/bin/clang-6.0+0x161b17f)
#0 0x0000000002c09738 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/home/alr48/cheri/output/sdk/bin/clang-6.0+0x2c09738)
#1 0x0000000002c09d76 SignalHandler(int) (/home/alr48/cheri/output/sdk/bin/clang-6.0+0x2c09d76)
#2 0x00000008049b2926 (/lib/libthr.so.3+0xe926)
#3 0x00000008049b1ecf (/lib/libthr.so.3+0xdecf)
Stack dump:
0.  Program arguments: /home/alr48/cheri/output/sdk/bin/clang-6.0 -cc1 -triple cheri-unknown-freebsd -emit-obj -disable-free -main-file-name duktape.c -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -mconstructor-aliases -target-cpu cheri128 -target-feature -noabicalls -target-feature +soft-float -target-feature +chericap -target-feature +cheri128 -target-abi purecap -Wmips-cheri-prototypes -msoft-float -mfloat-abi soft -cheri-size 128 -dwarf-column-info -debugger-tuning=gdb -coverage-notes-file /exports/users/alr48/sources/jsrun/duktape.gcno -resource-dir /home/alr48/cheri/output/sdk/lib/clang/6.0.0 -D DUK_OPT_NO_ASSERTIONS=1 -D DUK_OPT_UNDERSCORE_SETJMP=1 -D DUK_OPT_DEBUG=3 -D DUK_OPT_FORCE_ALIGN=16 -D DUK_USE_PACKED_TVAL=1 -I /usr/include/edit -isysroot /home/alr48/cheri/output/sdk/bin//../sysroot128 -O2 -fdebug-compilation-dir /exports/users/alr48/sources/jsrun -ferror-limit 19 -fmessage-length 115 -fobjc-runtime=gnustep -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -cheri-linker -mllvm -cheri-no-global-bounds -o duktape.o -x c duktape.c
1.  <eof> parser at end of file
2.  Per-module optimization passes
3.  Running pass 'CallGraph Pass Manager' on module 'duktape.c'.
4.  Running pass 'SROA' on function '@duk_bi_buffer_readfield'
clang-6.0: error: unable to execute command: Abort trap
clang-6.0: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 6.0.0 (https://github.com/llvm-mirror/clang.git e65b42952670193a1140350fe0c331383be5f211) (https://github.com/llvm-mirror/llvm.git ed9fa29f569c2aca2e77e9b51ea770471e051ef9)
Target: cheri-unknown-freebsd
Thread model: posix
InstalledDir: /home/alr48/cheri/output/sdk/bin//../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.

Reduced test case:

// RUN: %cheri_purecap_cc1 -emit-obj -cheri-size 128 -O2 -fcolor-diagnostics -vectorize-loops -vectorize-slp -mllvm -cheri-no-global-bounds -o -  %s
int a, b;
char c;
union e {
  double d;
  float f[2];
  char g[8]
} h() {
  union e d;
  switch (a)
  case 3:
    i(d.f[0]);
  memcpy(d.g, &c + b, 8);
  d.d;
}
davidchisnall commented 6 years ago

This appears to have been fixed some time ago.