llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.14k stars 12.02k forks source link

Assertion failed: (getOperand(0)->getType() == cast<PointerType>(getOperand(1)->getType())->getElementType() && "Ptr must be a pointer to Val type!") #28042

Open llvmbot opened 8 years ago

llvmbot commented 8 years ago
Bugzilla Link 27668
Version trunk
OS MacOS X
Attachments Args / Command, Proprocessed source
Reporter LLVM Bugzilla Contributor
CC @ahatanak,@hyp,@compnerd,@DougGregor

Extended Description

Assertion failed: (getOperand(0)->getType() == cast(getOperand(1)->getType())->getElementType() && "Ptr must be a pointer to Val type!"), function AssertOK, file ../lib/IR/Instructions.cpp, line 1370. 0 libLLVMSupport.dylib 0x0000000103e7851b llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 43 1 libLLVMSupport.dylib 0x0000000103e77726 llvm::sys::RunSignalHandlers() + 70 2 libLLVMSupport.dylib 0x0000000103e78d71 SignalHandler(int) + 641 3 libsystem_platform.dylib 0x00007fff95fd452a _sigtramp + 26 4 libsystem_platform.dylib 0x00007fff664cb9a5 _sigtramp + 3494868117 5 libLLVMSupport.dylib 0x0000000103e78a46 abort + 22 6 libLLVMSupport.dylib 0x0000000103e78a21 __assert_rtn + 81 7 libLLVMCore.dylib 0x0000000103687763 llvm::StoreInst::AssertOK() + 211 8 libLLVMCore.dylib 0x0000000103687842 llvm::StoreInst::StoreInst(llvm::Value, llvm::Value, bool, llvm::Instruction) + 34 9 libclangCodeGen.dylib 0x00000001042a17e4 clang::CodeGen::CGBuilderTy::CreateStore(llvm::Value, clang::CodeGen::Address, bool) + 84 10 libclangCodeGen.dylib 0x000000010437a750 clang::CodeGen::CodeGenFunction::EmitStoreOfScalar(llvm::Value, clang::CodeGen::Address, bool, clang::QualType, clang::CodeGen::AlignmentSource, llvm::MDNode, bool, clang::QualType, unsigned long long, bool) + 944 11 libclangCodeGen.dylib 0x000000010436a3af clang::CodeGen::CodeGenFunction::EmitStoreThroughLValue(clang::CodeGen::RValue, clang::CodeGen::LValue, bool) + 1135 12 libclangCodeGen.dylib 0x00000001043b18d4 clang::StmtVisitorBase<clang::make_ptr, (anonymous namespace)::ScalarExprEmitter, llvm::Value>::Visit(clang::Stmt) + 5140 13 libclangCodeGen.dylib 0x00000001043aa938 clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const, bool) + 104 14 libclangCodeGen.dylib 0x0000000104368fa2 clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr const, clang::CodeGen::AggValueSlot, bool) + 66 15 libclangCodeGen.dylib 0x0000000104368f4d clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const) + 93 16 libclangCodeGen.dylib 0x0000000104450bb3 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const) + 531 17 libclangCodeGen.dylib 0x0000000104459e1b clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) + 91 18 libclangCodeGen.dylib 0x00000001043c7605 clang::CodeGen::CodeGenFunction::GenerateObjCMethod(clang::ObjCMethodDecl const) + 229 19 libclangCodeGen.dylib 0x00000001044a7cb7 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl) + 775 20 libclangCodeGen.dylib 0x00000001045250ef (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) + 143 21 libclangCodeGen.dylib 0x000000010448c3c5 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) + 165 22 libclangParse.dylib 0x00000001052ef162 clang::ParseAST(clang::Sema&, bool, bool) + 482 23 libclangFrontend.dylib 0x00000001047ff1d9 clang::FrontendAction::Execute() + 73 24 libclangFrontend.dylib 0x00000001047c56c1 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 1105 25 libclangFrontendTool.dylib 0x00000001048af4c5 clang::ExecuteCompilerInvocation(clang::CompilerInstance) + 4629 26 clang-3.9 0x00000001012885cb cc1_main(llvm::ArrayRef<char const>, char const, void) + 1355 27 clang-3.9 0x0000000101287033 main + 12003 28 libdyld.dylib 0x00007fff87d615ad start + 1 Stack dump:

  1. Program arguments: /usr/local/bin/clang-3.9 -cc1 -triple x86_64-apple-macosx10.11.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -disable-free -main-file-name OFXMLElement.m -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 264.3.101 -dwarf-column-info -debug-info-kind=standalone -dwarf-version=2 -debugger-tuning=lldb -coverage-file /Users/js/Devel/ObjFW/src/OFXMLElement.lib.o -resource-dir /usr/local/bin/../lib/clang/3.9.0 -D PIC -I . -I .. -I exceptions -I runtime -cxx-isystem /Library/Developer/CommandLineTools/usr/include/c++/v1 -O2 -Wall -Wshorten-64-to-32 -Wsemicolon-before-method-body -Wobjc-property-synthesis -Wwrite-strings -Wpointer-arith -Werror -Wcast-align -Wdocumentation -pedantic -std=gnu11 -fconst-strings -fdebug-compilation-dir /Users/js/Devel/ObjFW/src -fconstant-string-class OFConstantString -ferror-limit 19 -fmessage-length 80 -pthread -stack-protector 1 -fblocks -fobjc-runtime=macosx-10.11.0 -fencode-extended-block-signature -fobjc-exceptions -fexceptions -fno-constant-cfstrings -fmax-type-align=16 -fno-common -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o OFXMLElement.lib.o -x objective-c OFXMLElement.m
  2. parser at end of file
  3. OFXMLElement.m:77:1: LLVM IR generation of declaration 'OFXMLElement::initialize' clang-3.9: error: unable to execute command: Illegal instruction: 4 clang-3.9: error: clang frontend command failed due to signal (use -v to see invocation) clang version 3.9.0 (git@github.com:llvm-mirror/clang.git d385c5143e097c37379960e90f255a8c0c1f95ed) (git@github.com:llvm-mirror/llvm.git bf20d51239d6e06a559bce1ec1424d4a078caf7d) Target: x86_64-apple-darwin15.4.0 Thread model: posix InstalledDir: /usr/local/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: /var/folders/q0/3knxpgyn5db6gs1dx9h_r3xh0000gn/T/OFXMLElement-ba16ed.m clang-3.9: note: diagnostic msg: /var/folders/q0/3knxpgyn5db6gs1dx9h_r3xh0000gn/T/OFXMLElement-ba16ed.sh clang-3.9: note: diagnostic msg:


llvmbot commented 2 years ago

mentioned in issue llvm/llvm-bugzilla-archive#32956

llvmbot commented 7 years ago

Bug llvm/llvm-bugzilla-archive#32956 has been marked as a duplicate of this bug.

compnerd commented 8 years ago

Stored value type does not match pointer operand type! store i8** %6, %1* %objects, align 8, !tbaa !​9 %"type 0x1040351f0"

Seems that we need a cast; %6 is most likely a call (running with master under a debugger indicates that the store is for a call).

compnerd commented 8 years ago

reduced.m Further reduced.

compnerd commented 8 years ago

This is a const conversion for the generic type that is failing to diagnose. Changing from a generic container to id seems to work. Assignment of const ObjectType to a NSObject const seems to trigger the assertion.

compnerd commented 8 years ago

reduced.m Reduced test case. The problem is a const check somewhere it seems.

Changing the NSObject * const * objects = [array objects]; to const NSObject * const * objects = [array objects]; allows the IRGen to succeed.