[llvm-bugs] [Bug 33897] New: Crash with invalid cast inside vector literal

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Jul 22 11:37:50 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=33897

            Bug ID: 33897
           Summary: Crash with invalid cast inside vector literal
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: OpenCL
          Assignee: unassignedclangbugs at nondot.org
          Reporter: J.Price at bristol.ac.uk
                CC: llvm-bugs at lists.llvm.org

Created attachment 18835
  --> https://bugs.llvm.org/attachment.cgi?id=18835&action=edit
Stack trace

The following code causes Clang/Sema to hit an `llvm_unreachable` with message
'illegal cast from pointer':

kernel void A(global float* b)
{
  (float4)(b);
}

This only happens when using the single element form of the vector literal.
Other forms produce the correct diagnostic ("initializing 'float' with an
expression of incompatible type ...").

There's a special case for this single element form (SemaExpr.cpp line 6083),
but it doesn't seem to validate the types before calling PrepareScalarCast(),
which assumes the inputs are valid.

Full stack trace attached.

-- 
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/20170722/b6445d3f/attachment.html>


More information about the llvm-bugs mailing list