[cfe-dev] Odd behaviour with '-save-temps' and OpenCL files

Martin J. O'Riordan via cfe-dev cfe-dev at lists.llvm.org
Sat Nov 5 15:14:11 PDT 2016


I'm not sure whether to direct this message to LLVM-Dev or CFE-Dev, but I
think CFE is more appropriate.

 

This is in respect to our out-of-tree implementation, derived from the
v3.9.0 sources.

 

If I am compiling a source file, and I use '-c -save-temps' (or '-c
-save-temps=obj'), the intermediate files '.i' or '.ii', '.bc' and '.s' are
retained as expected; but in an odd twist, I get errors when I compile
OpenCL files with the '.cl' extension.

 

This only happens if the OpenCL source uses the keyword 'half'.  If I do not
use '-save-temps' then everything works correctly, but when I do use
'-save-temps' it fails to parse 'half' as being valid.  The errors I get
when I use '-save-temps' are:

 

warning: unknown pragma ignored

for:

#pragma OPENCL EXTENSION cl_khr_fp16 : enable

 

and then subsequent uses of 'half' such as:

 

typedef __attribute__((ext_vector_type(2))) half half2;

result in:

error: unknown type name 'half'

 

When I omit '-save-temps' the source compiles correctly with no warnings or
errors.

 

Any idea what might be happening here?  Are there changes in OpenCL support
that I need to update my library sources for?  Most of these are from the
'libclc' sources, though I do have local edits that might be stale with
respect to recent changes for OpenCL support.

 

Thanks,

 

            MartinO

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20161105/a6c74849/attachment.html>


More information about the cfe-dev mailing list