[LLVMbugs] [Bug 18119] New: 3.4 release branch failed to compile a simple opencl kernel

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Dec 2 18:58:10 PST 2013


http://llvm.org/bugs/show_bug.cgi?id=18119

            Bug ID: 18119
           Summary: 3.4 release branch failed to compile a simple opencl
                    kernel
           Product: clang
           Version: trunk
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: zhigang.gong at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The kernel's source code is as below:

typedef unsigned int uint;
struct xyz{
  unsigned short b;
  unsigned short e;
  unsigned int o;
};
__kernel void
compiler_group_size4(__global struct xyz *src, __global unsigned int *dst,
unsigned int num, unsigned int c)
{
  uint idx = (uint)get_global_id(0);
  struct xyz td = src[idx];
  for(unsigned x = td.b;x<=td.e;x++)
    dst[td.o+x] = c;
}

The assertion is triggered as below:

gongzg at gongzg-ivb:~/git/fdo/build$ clang -cc1 -x cl -triple spir -emit-llvm -O1
compiler_group_size.cl
compiler_group_size.cl:10:20: warning: implicit declaration of function
'get_global_id' is invalid in C99
  uint idx = (uint)get_global_id(0);
                   ^
clang: /home/gongzg/git/llvm-3.2/llvm/lib/IR/Instructions.cpp:2352: static
llvm::CastInst *llvm::CastInst::Create(Instruction::CastOps, llvm::Value *,
llvm::Type *, const llvm::Twine &, llvm::Instruction *): Assertion
`castIsValid(op, S, Ty) && "Invalid cast!"' failed.
0  clang           0x0000000002196525 llvm::sys::PrintStackTrace(_IO_FILE*) +
37
1  clang           0x0000000002196963
2  libpthread.so.0 0x00007ffe5d57ecb0
3  libc.so.6       0x00007ffe5c3a0425 gsignal + 53
4  libc.so.6       0x00007ffe5c3a3b8b abort + 379
5  libc.so.6       0x00007ffe5c3990ee
6  libc.so.6       0x00007ffe5c399192
7  clang           0x0000000002119b94
8  clang           0x0000000001e05c77
9  clang           0x0000000001e05959
10 clang           0x0000000001e0972f
11 clang           0x0000000001e0144f
12 clang           0x0000000001e010ba
13 clang           0x0000000001e00473
14 clang           0x0000000001dfb5a7
15 clang           0x0000000001df91b9
16 clang           0x000000000212c6fa
llvm::FPPassManager::runOnFunction(llvm::Function&) + 362
17 clang           0x000000000212be5e
llvm::legacy::FunctionPassManagerImpl::run(llvm::Function&) + 238
18 clang           0x000000000212bcfd
llvm::legacy::FunctionPassManager::run(llvm::Function&) + 93
19 clang           0x000000000084cdf5
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::Module*,
clang::BackendAction, llvm::raw_ostream*) + 5845
20 clang           0x000000000084ab26
21 clang           0x00000000009b9a13 clang::ParseAST(clang::Sema&, bool, bool)
+ 515
22 clang           0x0000000000849da2 clang::CodeGenAction::ExecuteAction() +
514
23 clang           0x00000000006c07c0 clang::FrontendAction::Execute() + 112
24 clang           0x000000000069db7d
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 925
25 clang           0x0000000000685100
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2880
26 clang           0x000000000067d37f cc1_main(char const**, char const**, char
const*, void*) + 687
27 clang           0x000000000068335e main + 9182
28 libc.so.6       0x00007ffe5c38b76d __libc_start_main + 237
29 clang           0x000000000067d009
Stack dump:
0.      Program arguments: clang -cc1 -x cl -triple spir -emit-llvm -O1
compiler_group_size.cl
1.      <eof> parser at end of file
2.      Per-function optimization
3.      Running pass 'SROA' on function '@compiler_group_size4'
Aborted (core dumped)

-- 
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/20131203/0fdf33a0/attachment.html>


More information about the llvm-bugs mailing list