llvm / llvm-project

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

Compiling OpenCL example fails with llvm 3.4. Did work correctly with 3.3. #18941

Closed llvmbot closed 10 years ago

llvmbot commented 10 years ago
Bugzilla Link 18567
Resolution FIXED
Resolved on Jul 15, 2014 00:14
Version unspecified
OS All
Attachments OpenCL input, Run script
Reporter LLVM Bugzilla Contributor
CC @arsenm

Extended Description

-- Command Output (stderr):

Assertion failed: (CastInst::castIsValid(Instruction::BitCast, C, DstTy) && "Invalid constantexpr bitcast!"), function getBitCast, file Constants.cpp, line 1674. 0 libLLVM-3.4.dylib 0x000000010ff4a650 llvm::sys::PrintStackTrace(sFILE) + 40 1 libLLVM-3.4.dylib 0x000000010ff4aa3a SignalHandler(int) + 245 2 libsystem_platform.dylib 0x00007fff8f36a5aa _sigtramp + 26 3 libsystem_platform.dylib 000000000000000000 _sigtramp + 1892244080 4 libLLVM-3.4.dylib 0x000000010ff4a8ae abort + 22 5 libLLVM-3.4.dylib 0x000000010ff4a898 abort + 0 6 libLLVM-3.4.dylib 0x000000010fb605f0 llvm::ConstantExpr::getAddrSpaceCast(llvm::Constant, llvm::Type*) + 0 7 clang 0x000000010ee034c5 std::1::pair<clang::CodeGen::OrderGlobalInits, llvm::Function> std::1::upper_bound<clang::CodeGen::CodeGenModule::GlobalInitPriorityCmp&, std::1::pair<clang::CodeGen::OrderGlobalInits, llvm::Function>, std::1::pair<clang::CodeGen::OrderGlobalInits, llvm::Function> >(std::__1::pair<clang::CodeGen::OrderGlobalInits, llvm::Function>, std::__1::pair<clang::CodeGen::OrderGlobalInits, llvm::Function>, std::__1::pair<clang::CodeGen::OrderGlobalInits, llvm::Function> const&, clang::CodeGen::CodeGenModule::GlobalInitPriorityCmp&) + 155959 8 clang 0x000000010ee02c4c std::1::pair<clang::CodeGen::OrderGlobalInits, llvm::Function> std::1::upper_bound<clang::CodeGen::CodeGenModule::GlobalInitPriorityCmp&, std::1::pair<clang::CodeGen::OrderGlobalInits, llvm::Function>, std::1::pair<clang::CodeGen::OrderGlobalInits, llvm::Function> >(std::__1::pair<clang::CodeGen::OrderGlobalInits, llvm::Function>, std::__1::pair<clang::CodeGen::OrderGlobalInits, llvm::Function>, std::__1::pair<clang::CodeGen::OrderGlobalInits, llvm::Function> const&, clang::CodeGen::CodeGenModule::GlobalInitPriorityCmp&) + 153790 9 clang 0x000000010ee04baf std::1::pair<clang::CodeGen::OrderGlobalInits, llvm::Function> std::1::__upper_bound<clang::CodeGen::CodeGenModule::GlobalInitPriorityCmp&, std::1::pair<clang::CodeGen::OrderGlobalInits, llvm::Function>, std::1::pair<clang::CodeGen::OrderGlobalInits, llvm::Function*> >(std::1::pair<clang::CodeGen::OrderGlobalInits, llvm::Function>, std::1::pair<clang::CodeGen::OrderGlobalInits, llvm::Function>, std::1::pair<clang::CodeGen::OrderGlobalInits, llvm::Function> const&, clang::CodeGen::CodeGenModule::GlobalInitPriorityCmp&) + 161825 10 clang 0x000000010ee028ca std::__1::pair<clang::CodeGen::OrderGlobalInits, llvm::Function> std::1::upper_bound<clang::CodeGen::CodeGenModule::GlobalInitPriorityCmp&, std::__1::pair<clang::CodeGen::OrderGlobalInits, llvm::Function>, std::__1::pair<clang::CodeGen::OrderGlobalInits, llvm::Function> >(std::1::pair<clang::CodeGen::OrderGlobalInits, llvm::Function>, std::1::pair<clang::CodeGen::OrderGlobalInits, llvm::Function>, std::1::pair<clang::CodeGen::OrderGlobalInits, llvm::Function*> const&, clang::CodeGen::CodeGenModule::GlobalInitPriorityCmp&) + 152892 11 clang 0x000000010ee021eb std::1::pair<clang::CodeGen::OrderGlobalInits, llvm::Function> std::1::upper_bound<clang::CodeGen::CodeGenModule::GlobalInitPriorityCmp&, std::1::pair<clang::CodeGen::OrderGlobalInits, llvm::Function>, std::1::pair<clang::CodeGen::OrderGlobalInits, llvm::Function> >(std::__1::pair<clang::CodeGen::OrderGlobalInits, llvm::Function>, std::__1::pair<clang::CodeGen::OrderGlobalInits, llvm::Function>, std::__1::pair<clang::CodeGen::OrderGlobalInits, llvm::Function> const&, clang::CodeGen::CodeGenModule::GlobalInitPriorityCmp&) + 151133 12 clang 0x000000010ee6b3a0 std::1::vector_base<std::1::pair<unsigned int, unsigned int>, std::1::allocator<std::1::pair<unsigned int, unsigned int> > >::~vector_base() + 47336 13 clang 0x000000010ee6912a std::1::vector_base<std::1::pair<unsigned int, unsigned int>, std::1::allocator<std::1::pair<unsigned int, unsigned int> > >::~vector_base() + 38514 14 clang 0x000000010ee6a7cb std::1::vector_base<std::1::pair<unsigned int, unsigned int>, std::1::allocator<std::1::pair<unsigned int, unsigned int> > >::~vector_base() + 44307 15 clang 0x000000010ee6c521 std::1::vector_base<std::1::pair<unsigned int, unsigned int>, std::1::allocator<std::1::pair<unsigned int, unsigned int> > >::~vector_base() + 51817 16 clang 0x000000010ee921f0 std::1::split_buffer<clang::CodeGen::VBTableInfo, std::1::allocator&>::split_buffer(unsigned long, unsigned long, std::1::allocator&) + 1026 17 clang 0x000000010ee5f60e void llvm::DeleteContainerSeconds<llvm::DenseMap<std::1::pair<clang::CXXRecordDecl const, clang::CharUnits>, clang::VTableLayout const, llvm::DenseMapInfo<std::1::pair<clang::CXXRecordDecl const*, clang::CharUnits> > > >(llvm::DenseMap<std::1::pair<clang::CXXRecordDecl const, clang::CharUnits>, clang::VTableLayout const, llvm::DenseMapInfo<std::1::pair<clang::CXXRecordDecl const*, clang::CharUnits> > >&) + 5834 18 clang 0x000000010eea35ec llvm::Type** std::1::uninitialized_copy<llvm::Type, llvm::Type>(llvm::Type, llvm::Type, llvm::Type*) + 474 19 clang 0x000000010ee5eefc void llvm::DeleteContainerSeconds<llvm::DenseMap<std::__1::pair<clang::CXXRecordDecl const, clang::CharUnits>, clang::VTableLayout const, llvm::DenseMapInfo<std::__1::pair<clang::CXXRecordDecl const, clang::CharUnits> > > >(llvm::DenseMap<std::1::pair<clang::CXXRecordDecl const, clang::CharUnits>, clang::VTableLayout const, llvm::DenseMapInfo<std::1::pair<clang::CXXRecordDecl const, clang::CharUnits> > >&) + 4024 20 clang 0x000000010ec9191f std::1::tree<std::1::pair<clang::edit::FileOffset, clang::edit::EditedSource::FileEdit>, std::1::map_value_compare<clang::edit::FileOffset, clang::edit::EditedSource::FileEdit, std::1::less, true>, std::1::allocator<std::1::pair<clang::edit::FileOffset, clang::edit::EditedSource::FileEdit> > >::destroy(std::1::tree_node<std::__1::pair<clang::edit::FileOffset, clang::edit::EditedSource::FileEdit>, void>) + 3953 21 clang 0x000000010ec75271 std::1::vector_base<clang::CompilerInstance, std::1::allocator<clang::CompilerInstance*> >::~vector_base() + 10149 22 clang 0x000000010ec4ca66 std::1::enable_if<is_forward_iterator<char const*>::value, void>::type std::1::basic_string<char, std::1::char_traits, std::1::allocator >::init<char const>(char const, char const*) + 3328 23 clang 0x000000010ec46b5c 24 clang 0x000000010ec4b5c7 std::1::split_buffer<llvm::SourceMgr::SrcBuffer, std::1::allocator&>::split_buffer(unsigned long, unsigned long, std::__1::allocator&) + 5817 25 libdyld.dylib 0x00007fff909715fd start + 1 26 libdyld.dylib 0x0000000000000036 start + 1869146682 Stack dump:

  1. Program arguments: /usr/local/Cellar/llvm/3.4/bin/clang -cc1 -triple x86_64-apple-macosx10.9.0 -emit-llvm-bc -disable-free -main-file-name program.cl -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -ffp-contract=off -masm-verbose -munwind-tables -target-cpu core-avx-i -target-linker-version 224.1 -coverage-file /tmp/poclps7zdw/pthread/program.bc -resource-dir /usr/local/Cellar/llvm/3.4/bin/../lib/clang/3.4 -include /Users/mikaelle/Projects/Vincit/webcl/pocl-testing/install-0.9/share/pocl/include/_kernel.h -D __OPENCL_VERSION__=120 -I . -Wno-format -fgnu-keywords -fdebug-compilation-dir /Users/mikaelle/Projects/Vincit/webcl/build-3.4-makefiles/tools/clang/tools/webcl-validator/test -ferror-limit 19 -fmessage-length 0 -stack-protector 1 -mstackrealign -fno-builtin -fblocks -fobjc-runtime=macosx-10.9.0 -fencode-extended-block-signature -fdiagnostics-show-option -vectorize-slp -ffake-address-space-map -ffake-address-space-map -o /tmp/poclps7zdw/pthread/program.bc -x cl /tmp/poclps7zdw//program.cl
  2. /tmp/poclps7zdw//program.cl:136:1: current parser token '__constant'
  3. /tmp/poclps7zdw//program.cl:130:39: LLVM IR generation of declaration 'constant_array_pointer_struct'
  4. /tmp/poclps7zdw//program.cl:130:39: Generating code for declaration 'constant_array_pointer_struct' clang: error: unable to execute command: Illegal instruction: 4 clang: error: clang frontend command failed due to signal (use -v to see invocation) clang version 3.4 (tags/RELEASE_34/final) Target: x86_64-apple-macosx10.9.0 Thread model: posix clang: 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: note: diagnostic msg:

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT: Preprocessed source(s) and associated run script(s) are located at: clang: note: diagnostic msg: /var/tmp/program-259123.cl clang: note: diagnostic msg: /var/tmp/program-259123.sh clang: note: diagnostic msg:


arsenm commented 10 years ago

The additional tests seem to be working now

arsenm commented 10 years ago

r206478 fixes the original bug. The other related testcases aren't really related, other than being the same common address space bug.

llvmbot commented 10 years ago

My apologies for not specifying the options to clang. I compile with:

clang -target nvptx--something -Xclang -fcuda-is-device

The something is not really important.

arsenm commented 10 years ago

Created attachment 12001 [details] Related CUDA test case

Both of these work for me without my patch

I take it back, I forgot to specify the target as nvptx

arsenm commented 10 years ago

Created attachment 12001 [details] Related CUDA test case

Both of these work for me without my patch

llvmbot commented 10 years ago

Related CUDA test case

llvmbot commented 10 years ago

CUDA test case

arsenm commented 10 years ago

I've posted a patch for this: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20140120/097806.html

arsenm commented 10 years ago

Reduced testcase