KhronosGroup / KhronosGroup/SYCL-CTS

reduction warning: bitwise negation of a boolean expression always evaluates to 'true'; did you mean logical negation?

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

Description

https://github.com/KhronosGroup/SYCL-CTS/blob/9691bc093d4d5b8965be68bfb0716e20fda6205b/tests/reduction/identity_helper.h#L47-L55

Build log:
```
[952/1195] Building CXX object tests/reduction/CMakeFiles/test_reduction_objects.dir/reducer_api_core.cpp.o
In file included from ../tests/reduction/reducer_api_core.cpp:24:
In file included from ../tests/reduction/reducer_api.h:27:
../tests/reduction/identity_helper.h:54:10: warning: bitwise negation of a boolean expression always evaluates to 'true'; did you mean logical negation? [-Wbool-operation]
54 | return ~AccumulatorT{};
| ^~~~~~~~~~~~~~~
| !
../tests/reduction/reducer_api.h:253:29: note: in instantiation of function template specialization 'get_identity, true>' requested here
253 | AccumulatorT expected = get_identity();
| ^
../tests/reduction/../common/type_coverage.h:404:5: note: in instantiation of member function 'check_reducer_identity_operator, bool>::operator()' requested here
404 | ((action{}(std::forward(args)...,
| ^
../tests/reduction/reducer_api.h:271:5: note: in instantiation of function template specialization 'for_all_types, std::multiplies, std::bit_and, std::bit_or,
std::bit_xor, sycl::logical_and, sycl::logical_or, sycl::minimum, sycl::maximum, sycl::queue &>' requested here
271 | for_all_types(op_types,
| ^
../tests/reduction/reducer_api_core.cpp:79:33: note: in instantiation of member function 'check_reducer_identity::operator()' requested here
79 | check_reducer_identity{}(queue, "bool");
| ^
../tests/reduction/../common/disabled_for_test_case.h:42:3: note: expanded from macro 'DISABLED_FOR_TEST_CASE'
42 | INTERNAL_CTS_DISABLED_FOR_TEST_CASE(__VA_ARGS__)
| ^
../tests/reduction/../common/disabled_for_test_case.h:130:40: note: expanded from macro 'INTERNAL_CTS_DISABLED_FOR_TEST_CASE'
130 | INTERNAL_CTS_MAYBE_DISABLE_TEST_CASE(INTERNAL_CTS_ENABLED_TEST_CASE, \
| ^
1 warning generated.
```

Contributor guide

Open the contributing guide

Research direction

Start with tests/reduction/identity_helper.h at lines 47-55 and reproduce the warning while building the reduction tests. Check the bool identity path used by reducer_api.h, then verify that the build completes without this warning and that the reduction tests still pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
testing-qa
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.