Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix 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 2 commits into
base: main
Choose a base branch
Loading
from

Conversation

StanFromIreland
Copy link
Contributor

(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
Contributor 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
Contributor Author

I clicked the Update button accidentally somehow.

@StanFromIreland
Copy link
Contributor 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.

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.

3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.