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

Warning: "‘lo’ may be used uninitialized in this function" in math_fsum in mathmodule.c #100873

Closed
sobolevn opened this issue Jan 9, 2023 · 3 comments
Assignees
Labels
type-bug An unexpected behavior, bug, or error

Comments

@sobolevn
Copy link
Member

sobolevn commented Jan 9, 2023

Looks like that after 87d3bd0 we got a new warning:
Снимок экрана 2023-01-09 в 10 40 53

Linked PRs

@sobolevn sobolevn added the type-bug An unexpected behavior, bug, or error label Jan 9, 2023
@mdickinson
Copy link
Member

This is a false positive; definitely not a bug, but there may be something we can do to silence the warning.

@ZeroIntensity
Copy link
Member

ZeroIntensity commented Jan 9, 2023

If it's a false positive, could casting to void help?

@mdickinson
Copy link
Member

The simple and quick fix would be to initialise lo to 0.0. Technically that might affect performance, but I very much doubt the effect would be measurable. The only reason I'd hesitate to just make that fix would be that if it's not clear to the compiler that lo isn't used uninitialized, then it's probably not clear to humans either. So there may be an opportunity to rework the code a bit to make it clearer to both humans and compilers. But that opportunity also comes with a risk of inadvertently breaking something.

So I think initialising lo to 0.0 at the point where it's declared is the way to go; we can always look at streamlining the algorithm code in a separate PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

4 participants