Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
AlexeySachkov opened this issue Jan 9, 2024 · 0 comments

Comments

@AlexeySachkov
Copy link
Contributor

/** bit_and */
template <
typename AccumulatorT, typename OperatorT,
std::enable_if_t<std::is_same_v<OperatorT, sycl::bit_and<AccumulatorT>> &&
std::is_integral_v<AccumulatorT>,
bool> = true>
AccumulatorT get_identity() {
return ~AccumulatorT{};
}

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<bool, std::bit_and<bool>, true>' requested here
  253 |     AccumulatorT expected = get_identity<AccumulatorT, OperatorT>();
      |                             ^
../tests/reduction/../common/type_coverage.h:404:5: note: in instantiation of member function 'check_reducer_identity_operator<std::bit_and<bool>, bool>::operator()' requested here
  404 |   ((action<types, actionArgsT...>{}(std::forward<argsT>(args)...,
      |     ^
../tests/reduction/reducer_api.h:271:5: note: in instantiation of function template specialization 'for_all_types<check_reducer_identity_operator, bool, std::plus<bool>, std::multiplies<bool>, std::bit_and<bool>, std::bit_or<bool>,
 std::bit_xor<bool>, sycl::logical_and<bool>, sycl::logical_or<bool>, sycl::minimum<bool>, sycl::maximum<bool>, sycl::queue &>' requested here
  271 |     for_all_types<check_reducer_identity_operator, AccumulatorT>(op_types,
      |     ^
../tests/reduction/reducer_api_core.cpp:79:33: note: in instantiation of member function 'check_reducer_identity<bool>::operator()' requested here
   79 |   check_reducer_identity<bool>{}(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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant