KhronosGroup / KhronosGroup/SYCL-CTS

vector operators `bool` warnings

Open
#850 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
C++
Stars
75
Forks
96
Avg merge
5d 18h
Merged PRs (30d)
4

Description

Can't insert a nice source code snippet in here, because source code is generated. Generator can be found here: [`tests/vector_operators/generate_vector_operators.py`](https://github.com/KhronosGroup/SYCL-CTS/blob/SYCL-2020/tests/vector_operators/generate_vector_operators.py)

Build log:
```
[936/1195] Building CXX object tests/vector_operators/CMakeFiles/test_vector_operators_objects.dir/vector_operators_bool.cpp.o
tests/vector_operators/vector_operators_bool.cpp:732:40: warning: converting the result of '<<' to a boolean; did you mean '(static_cast<_Bool>(1) << static_cast<_Bool>(2)) != 0'? [-Wint-in-bool-context]
732 | resArr[i] = static_cast(1) << static_cast(2);
| ^
tests/vector_operators/vector_operators_bool.cpp:836:40: warning: converting the result of '<<' to a boolean; did you mean '(static_cast<_Bool>(1) << static_cast<_Bool>(2)) != 0'? [-Wint-in-bool-context]
836 | resArr[i] = static_cast(1) << static_cast(2);
| ^
tests/vector_operators/vector_operators_bool.cpp:976:19: warning: bitwise negation of a boolean expression always evaluates to 'true'; did you mean logical negation? [-Wbool-operation]
976 | resArr[i] = ~static_cast(1);
| ^~~~~~~~~~~~~~~~~~~~~
| !
```

Contributor guide

Open the contributing guide

Research direction

Start with tests/vector_operators/generate_vector_operators.py and inspect how it produces tests/vector_operators/vector_operators_bool.cpp. Rebuild the vector operator tests to reproduce the reported warnings, then verify the generated bool-operator cases no longer emit the listed diagnostics.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.