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

Fix usage of uninitialized variable value #128

Merged
merged 1 commit into from
Nov 11, 2023

Conversation

alugowski
Copy link
Contributor

@alugowski alugowski commented Nov 11, 2023

Fixes a usage of uninitialized variable value in [cdsz]langs.c if the abort conditions are triggered. Yes this isn't a true usage since ABORT will call exit() but it still causes a compiler warning in some cases.

This pops up whenever SciPy is compiled with LLVM, which happens to be configured to emit this warning:

[504/1606] Compiling C object scipy/sparse/linalg/_dsolve/libsuperlu_lib.a.p/SuperLU_SRC_clangs.c.o
../scipy/sparse/linalg/_dsolve/SuperLU/SRC/clangs.c:104:16: warning: variable 'value' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
    } else if (strncmp(norm, "I", 1)==0) {
               ^~~~~~~~~~~~~~~~~~~~~~~~
../scipy/sparse/linalg/_dsolve/SuperLU/SRC/clangs.c:126:13: note: uninitialized use occurs here
    return (value);
            ^~~~~
../scipy/sparse/linalg/_dsolve/SuperLU/SRC/clangs.c:104:12: note: remove the 'if' if its condition is always true
    } else if (strncmp(norm, "I", 1)==0) {
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../scipy/sparse/linalg/_dsolve/SuperLU/SRC/clangs.c:78:18: note: initialize the variable 'value' to silence this warning
    float   value, sum;
                 ^
                  = 0.0
1 warning generated.

and of course 3 more copies, one each for the other 3 files.

@alugowski
Copy link
Contributor Author

Here is one example of a SciPy CI build showing this warning: https://github.com/scipy/scipy/actions/runs/6829934632/job/18577020364#step:10:746

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

Successfully merging this pull request may close these issues.

2 participants