Skip to content

Commit b4f8a7f

Browse files
thugheskartben
authored andcommitted
tests: lib: cmsis_dsp: Fix -Wsometimes-uninitialized warning
Building libraries.cmsis_dsp.distance with clang warns: tests/lib/cmsis_dsp/distance/src/f32.c:99:3: error: variable 'val' is used uninitialized whenever switch default is taken [-Werror,-Wsometimes-uninitialized] default: ^~~~~~~ tests/lib/cmsis_dsp/distance/src/f32.c:104:19: note: uninitialized use occurs here output[index] = val; ^~~ tests/lib/cmsis_dsp/distance/src/f32.c:57:16: note: initialize the variable 'val' to silence this warning float32_t val; ^ = 0.0 Not really necessary since there is a zassert_unreachable, but doesn't hurt to initialize the variable. Signed-off-by: Tom Hughes <tomhughes@chromium.org>
1 parent 7c11db9 commit b4f8a7f

File tree

1 file changed

+1
-1
lines changed
  • tests/lib/cmsis_dsp/distance/src

1 file changed

+1
-1
lines changed

tests/lib/cmsis_dsp/distance/src/f32.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static void test_arm_distance_f32(int op, bool scratchy, const uint16_t *dims,
5454

5555
/* Enumerate input */
5656
for (index = 0; index < length; index++) {
57-
float32_t val;
57+
float32_t val = 0.0f;
5858

5959
/* Load input values into the scratch buffers */
6060
if (scratchy) {

0 commit comments

Comments
 (0)