-
Notifications
You must be signed in to change notification settings - Fork 51
Open
Description
(tested on spirv-1.1 branch)
Here is a test file based on examples from OpenCL C++ specification:
struct foo1
{
char a;
int x[2] [[cl::packed]];
int y [[cl::packed]];
};
struct foo2
{
int x[2] [[cl::aligned(8)]];
int y [[cl::aligned(8)]];
};
int x [[cl::aligned(16)]] = 0;
short array[3] [[cl::aligned]];Output for clang -cc1 array-attribute-cpp.cl -triple spir-unknown-unknown -cl-std=c++:
array-attribute-cpp.cl:4:16: error: 'packed' attribute cannot be applied to types
int x[2] [[cl::packed]];
^
array-attribute-cpp.cl:10:16: error: 'aligned' attribute cannot be applied to types
int x[2] [[cl::aligned(8)]];
^
array-attribute-cpp.cl:15:18: error: 'aligned' attribute cannot be applied to types
short array[3] [[cl::aligned]];
^
3 errors generated.
The same OpenCL C code (but using __attribute__) is compiled without errors:
struct foo1
{
char a;
int x[2] __attribute__ ((packed));
int y __attribute__ ((packed));
};
struct foo2
{
int x[2] __attribute__ ((aligned (8)));
int y __attribute__ ((aligned (8)));
};
int x __attribute__((aligned (16))) = 0;
short array[3] __attribute__ ((aligned));(Interesting that int z [[cl::aligned(8)]] [2]; is compiled, but int z __attribute__ ((aligned (8))) [2]; is not)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels