[llvm-bugs] [Bug 35826] New: LLVM 6 _Generic keyword with OpenCL produces false error

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jan 4 10:35:00 PST 2018


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

            Bug ID: 35826
           Summary: LLVM 6 _Generic keyword with OpenCL produces false
                    error
           Product: new-bugs
           Version: 6.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: rakka at runbox.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 19629
  --> https://bugs.llvm.org/attachment.cgi?id=19629&action=edit
reproducer

Compiling the attached code sample with LLVM 5 works, but fails with LLVM 6.

--------------------------------------

$ <LLVM_5>/bin/clang -x cl -cl-kernel-arg-info -cl-std=CL1.2  -o /tmp/test2.o
-c test1.cl -include <LLVM_5>/lib/clang/5.0.1/include/opencl-c.h 

... no error

--------------------------------------

$ <LLVM_6>/bin/clang -x cl -cl-kernel-arg-info -cl-std=CL1.2  -o /tmp/test2.o
-c test1.cl -include <LLVM_6>/lib/clang/6.0.0/include/opencl-c.h 

test1.cl:13:18: error: controlling expression type 'stype' (aka 'float') not
compatible with any generic association type
_Static_assert ( is_floating(stype), "stype");
                 ^~~~~~~~~~~~~~~~~~
test1.cl:3:35: note: expanded from macro 'is_floating'
 # define is_floating(T) _Generic((T)(0.0f), float: 1, double: 1)
                                  ^~~~~~~~~
1 error generated.

-------------------------------------

I understand _Generic is a C11 keyword, but Clang documentation states:

As an extension, the C11 generic selection expression is available in all
languages supported by Clang. The syntax is the same as that given in the C11
standard.

has this changed ?

-- 
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/20180104/930be7cc/attachment.html>


More information about the llvm-bugs mailing list