<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Assertion failed: (castIsValid(op, S, Ty) && "Invalid cast!"), function Create, file /Users/eschnett/src/llvm-3.4/lib/IR/Instructions.cpp, line 2352"
   href="http://llvm.org/bugs/show_bug.cgi?id=18001">18001</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Assertion failed: (castIsValid(op, S, Ty) && "Invalid cast!"), function Create, file /Users/eschnett/src/llvm-3.4/lib/IR/Instructions.cpp, line 2352
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Frontend
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>schnetter@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=11569" name="attach_11569" title="preprocessed source">attachment 11569</a> <a href="attachment.cgi?id=11569&action=edit" title="preprocessed source">[details]</a></span>
preprocessed source

I am using LLVM 3.4 (release branch). I call clang with
{{{
/Users/eschnett/llvm-3.4/bin/clang --target=x86_64-apple-macosx10.9.0
-march=core-avx-i -Xclang -ffake-address-space-map -emit-llvm -ffp-contract=off
-x cl -D__OPENCL_VERSION__=120 -fsigned-char -c -o atomics.cl.bc
../../../../pocl/lib/kernel/atomics.cl -include
/Users/eschnett/src/pocl-build/../pocl/include/_kernel.h
}}}

and receive the error
{{{
Assertion failed: (castIsValid(op, S, Ty) && "Invalid cast!"), function Create,
file /Users/eschnett/src/llvm-3.4/lib/IR/Instructions.cpp, line 2352.
0  libLLVM-3.4svn.dylib     0x000000010f9ef6e8
llvm::sys::PrintStackTrace(__sFILE*) + 40
1  libLLVM-3.4svn.dylib     0x000000010f9efbf4 SignalHandler(int) + 564
2  libsystem_platform.dylib 0x00007fff8c55a5aa _sigtramp + 26
3  libsystem_platform.dylib 000000000000000000 _sigtramp + 1940544112
4  libLLVM-3.4svn.dylib     0x000000010f9ef9a6 abort + 22
5  libLLVM-3.4svn.dylib     0x000000010f9ef981 __assert_rtn + 81
6  libLLVM-3.4svn.dylib     0x000000010f33413d
llvm::CastInst::Create(llvm::Instruction::CastOps, llvm::Value*, llvm::Type*,
llvm::Twine const&, llvm::Instruction*) + 2333
7  clang                    0x000000010de9334c void
std::__1::vector<clang::serialization::ModuleFile*,
std::__1::allocator<clang::serialization::ModuleFile*>
<span class="quote">>::__push_back_slow_path<clang::serialization::ModuleFile*</span >
const>(clang::serialization::ModuleFile* const&) + 241884
8  clang                    0x000000010df01187
std::__1::vector<llvm::Constant*, std::__1::allocator<llvm::Constant*>
<span class="quote">>::__append(unsigned long, llvm::Constant* const&) + 55847</span >
9  clang                    0x000000010defa847
std::__1::vector<llvm::Constant*, std::__1::allocator<llvm::Constant*>
<span class="quote">>::__append(unsigned long, llvm::Constant* const&) + 28903</span >
10 clang                    0x000000010def3e20
std::__1::vector<llvm::Constant*, std::__1::allocator<llvm::Constant*>
<span class="quote">>::__append(unsigned long, llvm::Constant* const&) + 1728</span >
11 clang                    0x000000010de7226d void
std::__1::vector<clang::serialization::ModuleFile*,
std::__1::allocator<clang::serialization::ModuleFile*>
<span class="quote">>::__push_back_slow_path<clang::serialization::ModuleFile*</span >
const>(clang::serialization::ModuleFile* const&) + 106493
12 clang                    0x000000010de6e909 void
std::__1::vector<clang::serialization::ModuleFile*,
std::__1::allocator<clang::serialization::ModuleFile*>
<span class="quote">>::__push_back_slow_path<clang::serialization::ModuleFile*</span >
const>(clang::serialization::ModuleFile* const&) + 91801
13 clang                    0x000000010ded70d8 void
std::__1::vector<llvm::TrackingVH<llvm::MDNode>,
std::__1::allocator<llvm::TrackingVH<llvm::MDNode> >
<span class="quote">>::__push_back_slow_path<llvm::TrackingVH<llvm::MDNode></span >
const>(llvm::TrackingVH<llvm::MDNode> const&) + 128264
14 clang                    0x000000010df008bd
std::__1::vector<llvm::Constant*, std::__1::allocator<llvm::Constant*>
<span class="quote">>::__append(unsigned long, llvm::Constant* const&) + 53597</span >
15 clang                    0x000000010defa91a
std::__1::vector<llvm::Constant*, std::__1::allocator<llvm::Constant*>
<span class="quote">>::__append(unsigned long, llvm::Constant* const&) + 29114</span >
16 clang                    0x000000010def3e20
std::__1::vector<llvm::Constant*, std::__1::allocator<llvm::Constant*>
<span class="quote">>::__append(unsigned long, llvm::Constant* const&) + 1728</span >
17 clang                    0x000000010df4f5f2 void
std::__1::vector<std::__1::pair<unsigned int, clang::CodeGen::CGBitFieldInfo
const*>, std::__1::allocator<std::__1::pair<unsigned int,
clang::CodeGen::CGBitFieldInfo const*> >
<span class="quote">>::__push_back_slow_path<std::__1::pair<unsigned int,</span >
clang::CodeGen::CGBitFieldInfo const*> const>(std::__1::pair<unsigned int,
clang::CodeGen::CGBitFieldInfo const*> const&) + 12290
18 clang                    0x000000010df4db29 void
std::__1::vector<std::__1::pair<unsigned int, clang::CodeGen::CGBitFieldInfo
const*>, std::__1::allocator<std::__1::pair<unsigned int,
clang::CodeGen::CGBitFieldInfo const*> >
<span class="quote">>::__push_back_slow_path<std::__1::pair<unsigned int,</span >
clang::CodeGen::CGBitFieldInfo const*> const>(std::__1::pair<unsigned int,
clang::CodeGen::CGBitFieldInfo const*> const&) + 5433
19 clang                    0x000000010df5342b void
std::__1::vector<std::__1::pair<unsigned int, clang::CodeGen::CGBitFieldInfo
const*>, std::__1::allocator<std::__1::pair<unsigned int,
clang::CodeGen::CGBitFieldInfo const*> >
<span class="quote">>::__push_back_slow_path<std::__1::pair<unsigned int,</span >
clang::CodeGen::CGBitFieldInfo const*> const>(std::__1::pair<unsigned int,
clang::CodeGen::CGBitFieldInfo const*> const&) + 28219
20 clang                    0x000000010df63613 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> > >&) + 24931
21 clang                    0x000000010df6e66c 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> > >&) + 70076
22 clang                    0x000000010df6bed2 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> > >&) + 59938
23 clang                    0x000000010df6d948 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> > >&) + 66712
24 clang                    0x000000010df7008d 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> > >&) + 76765
25 clang                    0x000000010df9e92f void
std::__1::vector<clang::CodeGen::VBTableInfo,
std::__1::allocator<clang::CodeGen::VBTableInfo>
<span class="quote">>::__push_back_slow_path<clang::CodeGen::VBTableInfo</span >
const>(clang::CodeGen::VBTableInfo const&) + 1599
26 clang                    0x000000010df5f7c4 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> > >&) + 8980
27 clang                    0x000000010dfb2fc3 void
std::__1::vector<clang::CodeGen::VBTableInfo,
std::__1::allocator<clang::CodeGen::VBTableInfo>
<span class="quote">>::__push_back_slow_path<clang::CodeGen::VBTableInfo</span >
const>(clang::CodeGen::VBTableInfo const&) + 85203
28 clang                    0x000000010df5e86a 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> > >&) + 5050
29 clang                    0x000000010dd01656
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<clang::edit::FileOffset>,
true>, std::__1::allocator<std::__1::pair<clang::edit::FileOffset,
clang::edit::EditedSource::FileEdit> >
<span class="quote">>::destroy(std::__1::__tree_node<std::__1::pair<clang::edit::FileOffset,</span >
clang::edit::EditedSource::FileEdit>, void*>*) + 5830
30 clang                    0x000000010dcdbd2d void
std::__1::vector<clang::CompilerInstance*,
std::__1::allocator<clang::CompilerInstance*>
<span class="quote">>::__push_back_slow_path<clang::CompilerInstance*</span >
const>(clang::CompilerInstance* const&) + 16205
31 clang                    0x000000010dca3a69
std::__1::enable_if<__is_forward_iterator<char const*>::value, void>::type
std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >::__init<char const*>(char const*, char const*) +
4601
32 clang                    0x000000010dc9b9e3
33 clang                    0x000000010dc9fc2c void
std::__1::vector<llvm::SourceMgr::SrcBuffer,
std::__1::allocator<llvm::SourceMgr::SrcBuffer>
<span class="quote">>::__push_back_slow_path<llvm::SourceMgr::SrcBuffer</span >
const>(llvm::SourceMgr::SrcBuffer const&) + 1548
34 libdyld.dylib            0x00007fff8aa4e5fd start + 1
Stack dump:
0.    Program arguments: /Users/eschnett/llvm-3.4/bin/clang -cc1 -triple
x86_64-apple-macosx10.9.0 -emit-llvm-bc -disable-free -main-file-name
atomics.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 136 -coverage-file
/Users/eschnett/src/pocl-build/lib/kernel/host/atomics.cl.bc -resource-dir
/Users/eschnett/llvm-3.4/bin/../lib/clang/3.4 -include
/Users/eschnett/src/pocl-build/../pocl/include/_kernel.h -D
__OPENCL_VERSION__=120 -fdebug-compilation-dir
/Users/eschnett/src/pocl-build/lib/kernel/host -ferror-limit 19
-fmessage-length 80 -stack-protector 1 -mstackrealign -fblocks
-fobjc-runtime=macosx-10.9.0 -fencode-extended-block-signature
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-slp
-ffake-address-space-map -o atomics.cl.bc -x cl
../../../../pocl/lib/kernel/atomics.cl 
1.    ../../../../pocl/lib/kernel/atomics.cl:79:1: current parser token
'__attribute__'
2.    ../../../../pocl/lib/kernel/atomics.cl:73:3: LLVM IR generation of
declaration 'atomic_add'
3.    ../../../../pocl/lib/kernel/atomics.cl:73:3: Generating code for
declaration 'atomic_add'
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 (branches/release_34 195215)
Target: x86_64-apple-macosx10.9.0
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> 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/folders/gl/zvl8d6415vsbkd50nnll95k40000gs/T/atomics-58b8d4.cl
clang: note: diagnostic msg:
/var/folders/gl/zvl8d6415vsbkd50nnll95k40000gs/T/atomics-58b8d4.sh
clang: note: diagnostic msg: 

********************
}}}</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>