[PATCH] Support OpenCL 1.2 'extern' storage class

Fraser Cormack fraser at codeplay.com
Wed Jan 22 09:07:04 PST 2014


On 22/01/14 17:01, Tom Stellard wrote:
> On Wed, Jan 22, 2014 at 04:03:29PM +0000, Fraser Cormack wrote:
>> This patch allows clang to compile the "extern" storage class in OpenCL 1.2.
>>
>> I've also added a test case for the issue.
> Does clang only complain if you use extern with constant address space
> variables?  Because it looks like extern is already handled in
> DeclSpec::SetStorageClassSpec()
>
> -Tom

It seems like it doesn't. If I try:

     extern float foo;

     void __kernel test_fn(__global float *out)
     {
       out[0] += foo;
     }

clang -cc1 -x cl -cl-std=CL1.2 -o test.ll test.cl

I receive the following error:

     test.cl:1:14: error: program scope variables are required to be 
declared in constant address space
     extern float foo;
              ^
     1 error generated.

Cheers,
Fraser

-- 
Fraser Cormack
Compiler Developer
Codeplay Software Ltd
45 York Place, Edinburgh, EH1 3HP
Tel: 0131 466 0503
Fax: 0131 557 6600
Website: http://www.codeplay.com
Twitter: https://twitter.com/codeplaysoft

This email and any attachments may contain confidential and /or privileged information and  is for use  by the addressee only. If you are not the intended recipient, please notify Codeplay Software Ltd immediately and delete the message from your computer. You may not copy or forward it,or use or disclose its contents to any other person. Any views or other information in this message which do not relate to our business are not authorized by Codeplay software Ltd, nor does this message form part of any contract unless so stated.
As internet communications are capable of data corruption Codeplay Software Ltd does not accept any responsibility for any changes made to this message after it was sent. Please note that Codeplay Software Ltd does not accept any liability or responsibility for viruses and it is your responsibility to scan any attachments.
Company registered in England and Wales, number: 04567874
Registered office: 81 Linkfield Street, Redhill RH1 6BY




More information about the cfe-commits mailing list