-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
gh-132026: Ensure _MIPS_SIM has defined _ABI identifiers for comparison #132027
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
Conversation
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Heads up: On Python 3.13 and older, this logic is not yet moved to |
f37099c
to
da82bea
Compare
…mparison When built on a MIPS architecture, `_MIPS_SIM` is used to determine architecture specifics. The value is expected to match either `_ABIO32`, `_ABIN32` or `_ABI64`. In `gcc` config/mips/mips.h these values are defined as compiler `builtin_define` inside of a switch/case. That means, mips64el and mips64 architectures know about `_ABI64` but don't know about `_ABIO32` and `_ABIN32`. In turn, when CPython tries to use them in comparison, they may be undefined identifiers. In default compiler behavior, the undefined identifier will be evaluated as zero, and it will not match `_MIPS_SIM`. However, the issues pop up when `-Wundef` (or, even worse, `-Werror=undef`) compiler flag is enabled. Then suddenly it's visible as a warning or error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a rewording of the NEWS entry.
Misc/NEWS.d/next/Build/2025-04-02-21-08-36.gh-issue-132026.ptnR7T.rst
Outdated
Show resolved
Hide resolved
@zware, thank you!
|
…mparison (pythonGH-132027) When built on a MIPS architecture, `_MIPS_SIM` is used to determine architecture specifics. The value is expected to match either `_ABIO32`, `_ABIN32` or `_ABI64`. In `gcc` config/mips/mips.h these values are defined as compiler `builtin_define` inside of a switch/case. That means, mips64el and mips64 architectures know about `_ABI64` but don't know about `_ABIO32` and `_ABIN32`. In turn, when CPython tries to use them in comparison, they may be undefined identifiers. In default compiler behavior, the undefined identifier will be evaluated as zero, and it will not match `_MIPS_SIM`. However, the issues pop up when `-Wundef` (or, even worse, `-Werror=undef`) compiler flag is enabled. Then suddenly it's visible as a warning or error. (cherry picked from commit 6985e2e) Co-authored-by: Valters Jansons <sigv@users.noreply.github.com>
GH-133092 is a backport of this pull request to the 3.13 branch. |
When building C code on a MIPS architecture,
_MIPS_SIM
is used to determine architecture specifics. The value is expected to match either_ABIO32
,_ABIN32
or_ABI64
.In
gcc
config/mips/mips.h these values are defined as compilerbuiltin_define
inside of a switch/case. That means, mips64el and mips64 architectures know about_ABI64
but don't know about_ABIO32
and_ABIN32
. In turn, when CPython tries to use them in comparison, they may be undefined identifiers.In default compiler behavior, the undefined identifier will be evaluated as zero, and it will not match
_MIPS_SIM
. However, the issues pop up when-Wundef
(or, even worse,-Werror=undef
) compiler flag is enabled. Then suddenly it's visible as a warning or error.