Skip to content

valueflow.cpp: fixed -Wmaybe-uninitialized GCC warning in optimized build#6430

Merged
firewave merged 1 commit intocppcheck-opensource:mainfrom
firewave:gcc-uninit
May 23, 2024
Merged

valueflow.cpp: fixed -Wmaybe-uninitialized GCC warning in optimized build#6430
firewave merged 1 commit intocppcheck-opensource:mainfrom
firewave:gcc-uninit

Conversation

@firewave
Copy link
Copy Markdown
Collaborator

lib/valueflow.cpp: In function ‘const Token* ValueFlow::solveExprValue(const Token*, const std::function<std::vector<long long int>(const Token*)>&, Value&)’:
lib/valueflow.cpp:8405:28: warning: ‘intval’ may be used uninitialized [-Wmaybe-uninitialized]
 8405 |             value.intvalue /= intval;
      |             ~~~~~~~~~~~~~~~^~~~~~~~~
lib/valueflow.cpp:8383:21: note: ‘intval’ was declared here
 8383 |     MathLib::bigint intval;
      |                     ^~~~~~

… build

```
lib/valueflow.cpp: In function ‘const Token* ValueFlow::solveExprValue(const Token*, const std::function<std::vector<long long int>(const Token*)>&, Value&)’:
lib/valueflow.cpp:8405:28: warning: ‘intval’ may be used uninitialized [-Wmaybe-uninitialized]
 8405 |             value.intvalue /= intval;
      |             ~~~~~~~~~~~~~~~^~~~~~~~~
lib/valueflow.cpp:8383:21: note: ‘intval’ was declared here
 8383 |     MathLib::bigint intval;
      |                     ^~~~~~
```
@firewave
Copy link
Copy Markdown
Collaborator Author

GCC is technically correct but the code using it will never be executed because of the logic involved.

@firewave firewave merged commit 3983c0c into cppcheck-opensource:main May 23, 2024
@firewave firewave deleted the gcc-uninit branch May 23, 2024 16:18
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