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

Initialize all function-level variables #159

Merged
merged 4 commits into from
Feb 13, 2025

Conversation

TomTheBear
Copy link
Contributor

Removes some compiler warnings

@hariharan-devarajan
Copy link
Member

Removes some compiler warnings

Thanks for the PR. Can you please add to the description the OS and compiler on which u get the warning.

@hariharan-devarajan
Copy link
Member

Also, Can u check the formatting error.

@TomTheBear
Copy link
Contributor Author

It's an Ubuntu 22.04 system with GCC 11.4.0 but I use a custom Makefile. My cmake knowledge is so limited, I cannot even add -Wall to the configuration.

It is basically just a single compiler warning:

/home/unrz139/Work/GOTCHA.orig/src/libc_wrappers.c: In function ‘gotcha_malloc’:
/home/unrz139/Work/GOTCHA.orig/src/libc_wrappers.c:72:41: warning: ‘best_fit_diff’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   72 |     if (diff >= 0 && (!best_fit || diff < best_fit_diff)) {
      |                                    ~~~~~^~~~~~~~~~~~~~~

But after I started, I checked all occurrences of variables that are not initialized in the beginning of a function. Most of them are set later and do not cause warnings.
Makefile.txt

Copy link
Member

@hariharan-devarajan hariharan-devarajan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good thanks.

@hariharan-devarajan hariharan-devarajan merged commit b56462a into LLNL:develop Feb 13, 2025
4 checks passed
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