-
Notifications
You must be signed in to change notification settings - Fork 14
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
-Wsometimes-uninitialized in net/atm/resources.c #386
Comments
This case looks trickier. Also, I don't get the same line numbers in my checkout of -next, so maybe that's making it hard to spot. The dual preprocessor and runtime check for compat is very odd. |
Hmm odd... Here is the full warning:
My guess is it is one of those "Clang does analysis before optimization" because when |
I'm not proud of this one: https://lore.kernel.org/lkml/20190307165741.19870-1-natechancellor@gmail.com/ |
When building with -Wsometimes-uninitialized, Clang warns: net/atm/resources.c:256:6: warning: variable 'number' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] net/atm/resources.c:212:7: warning: variable 'iobuf_len' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] Clang won't realize that compat is 0 when CONFIG_COMPAT is not set until the constant folding stage, which happens after this semantic analysis. Use IS_ENABLED instead so that the zero is present at the semantic analysis stage, which eliminates this warning. Link: ClangBuiltLinux#386 Signed-off-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
When building with -Wsometimes-uninitialized, Clang warns: net/atm/resources.c:256:6: warning: variable 'number' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] net/atm/resources.c:212:7: warning: variable 'iobuf_len' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] Clang won't realize that compat is 0 when CONFIG_COMPAT is not set until the constant folding stage, which happens after this semantic analysis. Use IS_ENABLED instead so that the zero is present at the semantic analysis stage, which eliminates this warning. Link: ClangBuiltLinux#386 Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Merged into mainline (second was a follow up fix): https://git.kernel.org/torvalds/c/f9d19a7494e5341a7f256823e32788ae560ca22f https://git.kernel.org/torvalds/c/0805a4b894a8daaf76ad99934563d8ecfc6e7aed |
from #381
The text was updated successfully, but these errors were encountered: