Skip to content

Commit

Permalink
Fix a gcc-8.4.0 warning
Browse files Browse the repository at this point in the history
  • Loading branch information
masterleinad committed Jun 15, 2023
1 parent 4a57a2e commit fff1bc6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions simd/unit_tests/TestSIMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,12 @@ void host_check_binary_op_one_loader(BinaryOp binary_op, std::size_t n,
loader.host_load(second_args + i, nlanes, second_arg);
if (!(loaded_first_arg && loaded_second_arg)) continue;
simd_type expected_result;
for (std::size_t lane = 0; lane < nlanes; ++lane) {
expected_result[lane] =
binary_op.on_host(T(first_arg[lane]), T(second_arg[lane]));
// gcc 8.4.0 warns if using nlanes as upper bound about first_arg and/or
// second_arg being uninitialized
for (std::size_t lane = 0; lane < simd_type::size(); ++lane) {
if (lane < nlanes)
expected_result[lane] =
binary_op.on_host(T(first_arg[lane]), T(second_arg[lane]));
}
simd_type const computed_result = binary_op.on_host(first_arg, second_arg);
host_check_equality(expected_result, computed_result, nlanes);
Expand Down

0 comments on commit fff1bc6

Please sign in to comment.