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

'binding_str' may be used uninitialized warning #58

Closed
AxelLin opened this issue Jan 19, 2022 · 1 comment
Closed

'binding_str' may be used uninitialized warning #58

AxelLin opened this issue Jan 19, 2022 · 1 comment

Comments

@AxelLin
Copy link

AxelLin commented Jan 19, 2022

Below line has build issue when compile with riscv32 gcc.
https://github.com/AVSystem/Anjay/blob/master/src/modules/server/anjay_server_persistence.c#L286

anjay/deps/avs_commons/include_public/avsystem/commons/avs_log_impl.h:63:9: error: 'binding_str' may be used uninitialized in this function [-Werror=maybe-uninitialized]
avs_log_internal_##Variant##__(Level, ModuleStr, FILE, LINE,
^~~~~~~~~~~~~~~~~
anjay/src/modules/server/anjay_server_persistence.c:286:17: note: 'binding_str' was declared here
const char *binding_str;
^~~~~~~~~~~

@kFYatek
Copy link
Contributor

kFYatek commented Jan 20, 2022

This is a false positive and thus harmless. The switch (binding) statement, in all cases, either sets binding_str or sets err = avs_errno(AVS_EBADMSG);, and the only usage of binding_str below is under if (avs_is_ok(err)) - the compiler is evidently not able to deduce the semantics of this check, hence the warning.

We will add some dummy initialization of this variable to silence this warning in future releases.

@AxelLin AxelLin closed this as completed Apr 14, 2022
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

2 participants