[LLVMbugs] [Bug 19957] New: OpenCL incorrectly accepts implicit address space conversion with ternary operator

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jun 5 13:29:00 PDT 2014


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

            Bug ID: 19957
           Summary: OpenCL incorrectly accepts implicit address space
                    conversion with ternary operator
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: Matthew.Arsenault at amd.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 12616
  --> http://llvm.org/bugs/attachment.cgi?id=12616&action=edit
Testcase

When there is an implicit address space conversion in a ternary operator, in
some cases it is incorrectly accepted. It produces a warning about mismatched
pointer types in some cases, but is the correct error about changing the
address space of the pointer in others.

An example of the broken case is:

kernel void implicit_cast_private(global int* gint, local int* lint, int cond)
{
    int *ptr = cond ? gint : lint;
} 

Which is merely a warning: pointer type mismatch ('__global int *' and '__local
int *')

A similar case which correctly errors:

kernel void implicit_cast_local(global int* gint, local int* lint, int cond)
{
    local int *ptr = cond ? gint : lint;
}

error: initializing '__local int *' with an expression of type 'void *' changes
      address space of pointer

-- 
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/20140605/42d2aaf9/attachment.html>


More information about the llvm-bugs mailing list