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

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

TomTheBear
Copy link

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
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

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