KhronosGroup / KhronosGroup/SPIR

xyzw and rgba selectors for vectors of 8 and 16 components

Open
#64 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
183
Forks
51
PR merge metrics
No merged PRs in 30d

Description

OpenCL C++ specification has this example:

```cpp
int8 v8;
...
int3 v8c1 = v8.xyz; // ill-formed: xyzw and rgba selectors
// are not allowed on vector expressions
// with more than 4 components
```

"Table 2.5: Selector values and their corresponding components in swizzle" allows xyzw and rgba selectors only for vectors of 2, 3, 4 components.

Currently clang compiles this code without errors or warnings.
Should it fail in this case?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the issue with the int8 v8 and v8.xyz example, then consult Table 2.5 of the OpenCL C++ specification for the permitted selector sizes. Trace the compiler's vector-selector validation and add coverage showing that xyzw and rgba selectors on 8- and 16-component vectors are rejected with a diagnostic.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.