Thanks to visit codestin.com
Credit goes to github.com

Skip to content

gh-132314: suppress maybe-uninitialized compiler warning #134207

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

StanFromIreland
Copy link
Member

(Bonus: 3 space indentation :-)

Found in this buildbot log.

@StanFromIreland StanFromIreland changed the title Fix compiler warning Fix maybe-uninitialized compiler warning May 19, 2025
@vstinner
Copy link
Member

vstinner commented May 19, 2025

Found in this buildbot log.

I don't see uninitialized newargs in warnings.

Python/ceval.c: In function '_PyEvalFramePushAndInit_Ex':
Python/ceval.c:1899:38: warning: 'stack_array' may be used uninitialized [-Wmaybe-uninitialized]
 1899 |     _PyInterpreterFrame *new_frame = _PyEvalFramePushAndInit(
      |                                      ^~~~~~~~~~~~~~~~~~~~~~~~
 1900 |         tstate, func, locals,
      |         ~~~~~~~~~~~~~~~~~~~~~         
 1901 |         newargs, nargs, kwnames, previous
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1902 |     );
      |     ~                                 
Python/ceval.c:1822:1: note: by argument 4 of type 'const _PyStackRef *' to '_PyEvalFramePushAndInit' declared here
 1822 | _PyEvalFramePushAndInit(PyThreadState *tstate, _PyStackRef func,
      | ^~~~~~~~~~~~~~~~~~~~~~~
Python/ceval.c:1868:17: note: 'stack_array' declared here
 1868 |     _PyStackRef stack_array[8];
      |                 ^~~~~~~~~~~

@StanFromIreland
Copy link
Member Author

StanFromIreland commented May 19, 2025

I gathered that the error is because the compiler does not know if stack_array would ever be used to initialize newargs, and therefore assumed it might remain uninitialized by the time it's passed to _PyEvalFramePushAndInit. Maybe I am wrong?

You can call the buildbot !buildbot Raspbian (Or !buildbot ARM64 Raspbian though that may call all ARM64 buildbots too?) to verify.

@chris-eibl
Copy link
Member

There is already this issue #132314 and PR #132376 for this false-positive warning.

@StanFromIreland
Copy link
Member Author

I clicked the Update button accidentally somehow.

@StanFromIreland
Copy link
Member Author

The pr proposed 2 different approaches, what do you think about this one?

@chris-eibl
Copy link
Member

chris-eibl commented May 21, 2025

I do not think that your approach here can silence the maybe uninitialized warning on stack_array. Which is a false-positive and I still think it should be silenced using a diagnostic pragma, which PR #132376 is already taking care about.

@StanFromIreland
Copy link
Member Author

@chris-eibl The other PR seems to have been forgotten, I propose we just ignore as normal then.

@chris-eibl
Copy link
Member

Yeah, after all, your approach here deals just with clang, which is the only compiler that issues the warning so far, so most probably no need to go with something like _Py_COMP_DIAG_IGNORE_MAYBE_UNINITIALIZED.

@picnixz
Copy link
Member

picnixz commented Jun 19, 2025

Is it right that this is attached to gh-132314? if so, please add that issue number.

@chris-eibl
Copy link
Member

chris-eibl commented Jun 19, 2025

deals just with clang

Ups, I was too fast: in the issue and in your referred log

Found in this buildbot log.

gcc is raising this warning ...

@chris-eibl chris-eibl self-requested a review June 19, 2025 18:00
@picnixz picnixz changed the title Fix maybe-uninitialized compiler warning gh-132314: Fix maybe-uninitialized compiler warning Jun 19, 2025
@picnixz picnixz changed the title gh-132314: Fix maybe-uninitialized compiler warning gh-132314: suppress maybe-uninitialized compiler warning Jun 19, 2025
@StanFromIreland StanFromIreland added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes and removed needs backport to 3.13 bugs and security fixes labels Jun 19, 2025
@StanFromIreland

This comment was marked as resolved.

@bedevere-bot

This comment was marked as resolved.

@StanFromIreland
Copy link
Member Author

@chris-eibl We have to move it, it did not work, see log.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants