[cfe-dev] Question about OpenCL language standard option

Joey Gouly Joey.Gouly at arm.com
Fri Nov 29 17:32:26 PST 2013


Hi JinGu,

I'm not sure I understand.. VLAs are *not* supported in OpenCL. See Restrictions 6.9.d.

Thanks,
Joey
________________________________________
From: cfe-commits-bounces at cs.uiuc.edu [cfe-commits-bounces at cs.uiuc.edu] On Behalf Of JinGu Kang [jingu at codeplay.com]
Sent: 29 November 2013 17:32
To: cfe-dev at cs.uiuc.edu; cfe-commits at cs.uiuc.edu
Subject: Question about OpenCL language standard option

Hi all,

I got a error from a opencl test. The test code is as following:

source code:
__kernel void test_fn(__global uint *src, __global uint4 *results) {
   const size_t SIZE = 128;
   int tid = get_global_id(0);
   if (tid*4 >= SIZE)
     return;
   __private uint sPrivateStorage[SIZE];
   for (size_t i=0 ; i<SIZE ; i++)
     sPrivateStorage[i] = src[i];
   results[tid] = vload4(tid, sPrivateStorage);
}

and the error message is as following:

"error: variable length arrays are not supported in OpenCL
   __private uint sPrivateStorage[SIZE];"

The problem is that 'isArraySizeVLA' function calls
'VerifyIntegerConstantExpression' with 'S.LangOpts.GNUMode'. The OpenCL
Language standard option does not have this option. It causes a error
because 'AllowFold' is not set to 1. In order to fix this error, I think
that we need to insert 'GNUMode' to  OpenCL LANGSTANDARD or modify
sligtly checking code. How do you feel about this? I can not guarantee
the side effect of 'GNUMode' with OpenCL. I have attached a simple patch
as reference. If there is something wrong, please let me know.

Thanks,
JinGu Kang

-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium.  Thank you.

ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No:  2557590
ARM Holdings plc, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No:  2548782





More information about the cfe-dev mailing list