gh-132026: Ensure _MIPS_SIM has defined _ABI identifiers for comparison#132027
gh-132026: Ensure _MIPS_SIM has defined _ABI identifiers for comparison#132027zware merged 2 commits intopython:mainfrom
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.
zware
left a comment
There was a problem hiding this comment.
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_SIMis used to determine architecture specifics. The value is expected to match either_ABIO32,_ABIN32or_ABI64.In
gccconfig/mips/mips.h these values are defined as compilerbuiltin_defineinside of a switch/case. That means, mips64el and mips64 architectures know about_ABI64but don't know about_ABIO32and_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.