-
Notifications
You must be signed in to change notification settings - Fork 7k
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
tests: lib: cmsis_dsp: Fix -Wsometimes-uninitialized
warning
#85182
base: main
Are you sure you want to change the base?
Conversation
df55661
to
e72db88
Compare
It feels like there has to be a better solution since this now means there is a very good chance the compiler will generate an additional instruction, will it not? |
It's a test. Does it really matter? |
Uh of course, I missed that, sorry! |
e72db88
to
8536f7a
Compare
8536f7a
to
90c2675
Compare
90c2675
to
2d0c26f
Compare
Building with clang warns: tests/lib/cmsis_dsp/distance/src/u32.c:82:3: error: variable 'val' is used uninitialized whenever switch default is taken [-Werror,-Wsometimes-uninitialized] default: ^~~~~~~ tests/lib/cmsis_dsp/distance/src/u32.c:87:19: note: uninitialized use occurs here output[index] = val; ^~~ tests/lib/cmsis_dsp/distance/src/u32.c:47:16: note: initialize the variable 'val' to silence this warning float32_t val; ^ = 0.0 Hitting the default switch will assert, so this won't cause any problems as written, but it doesn't hurt to initialize the variable. Signed-off-by: Tom Hughes <tomhughes@chromium.org>
2d0c26f
to
5fa7cda
Compare
Building with clang warns:
Hitting the default switch will assert, so this won't cause any problems as written, but it doesn't hurt to initialize the variable.