[Ada] CUDA: fix CUDA_Execute not working with aggregates

Pierre-Marie de Rodat derodat@adacore.com
Fri Oct 23 08:26:40 GMT 2020


When expanding pragma CUDA_Execute, the compiler declares temporary
variables to capture the value of the pragma's arguments. These
declarations's type is inferred from the pragma's arguments type,
because said arguments could be integers of CUDA.Vector_Types.Dim3s.

Inferring the type of these declarations failed when the CUDA_Execute
pragma was given an aggregate which should be treated as a Dim3. This is
because the aggregate does not have a type.

Fixing this is as simple as checking for the aggregate case and using a
Dim3 when needed.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* exp_prag.adb (Etype_Or_Dim3): New function.
	(Expand_Pragma_Cuda_Execute): Use Etype_Or_Dim3 for temporary
	decls.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-diff
Size: 2114 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20201023/cba5da70/attachment-0001.bin>


More information about the Gcc-patches mailing list