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

sipmsgops: fix warning: ‘*’ may be used uninitialized [-Wmaybe-uninit… #3604

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ovidiusas
Copy link
Member

Fix the following warning for gcc version 13.3.0:

sipmsgops.c: In function ‘get_updated_body_part_f’:
sipmsgops.c:1093:28: warning: ‘p’ may be used uninitialized [-Wmaybe-uninitialized]
 1093 |                         if (it!=p) {
      |                            ^
sipmsgops.c:1019:27: note: ‘p’ was declared here
 1019 |         struct body_part *p, *it;
      |                           ^
sipmsgops.c:1100:47: warning: ‘parts’ may be used uninitialized [-Wmaybe-uninitialized]
 1100 |                 msg->body->updated_part_count = parts;
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
sipmsgops.c:1020:43: note: ‘parts’ was declared here
 1020 |         unsigned int out_offs, orig_offs, parts;
      |                                           ^~~~~

@bogdan-iancu
Copy link
Member

I'm more than happy to keep the compiler quite, but IMHO, this is a very false alarm - both parts and p are initialized and used under the same test if (type) ; this var does not change across the functions, so not sure what the compiler is detecting.

@ovidiusas
Copy link
Member Author

Yes, it is a false alarm, at least for now. The compiler is not smart enough to figure out the logic around the two if's and the fact that type is not changed between the two blocks.
On the other hand, those warnings are annoying and initializing those variables is harmless.

Copy link
Member

@liviuchircu liviuchircu left a comment

Choose a reason for hiding this comment

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

LGTM - let's just merge it, although it's unnecessary (the compiler should be smart enough to not report such a false problem).

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.

3 participants