llvm / llvm/llvm-project

[Clang] bogus error about vector values of different size

Open
#161,360 1 comment 0 reactions 0 assignees View on GitHub
clang:diagnostics
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

With `-flax-vector-conversions=none`, clang rejects the following code:
```c++
template
using vec [[clang::ext_vector_type(4)]] = T;

auto test(vec v, vec v2) {
return v == v2;
}
```

I'm not quite sure whether it's intended to work, but the diagnostic message is definitely bogus:
```
:6:12: error: cannot convert between vector values of different size ('vec' (vector of 4 'int' values) and 'vec' (vector of 4 'const int' values))
6 | return v == v2;
| ~ ^ ~~
```
Both the element size and total vector size are identical.

Contributor guide

Open the contributing guide

Research direction

Reproduce the reduced C++ example with -flax-vector-conversions=none and compare the reported vector sizes for vec and vec. Trace the diagnostic path that handles the v == v2 comparison; done means the diagnostic no longer claims the vectors have different sizes, with behavior matching the intended handling of these vector types.

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
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.