Skip to content

[3.13] gh-132026: Ensure _MIPS_SIM has defined _ABI identifiers for comparison (GH-132027) #133092

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

Merged
merged 1 commit into from
Apr 28, 2025

Conversation

miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Apr 28, 2025

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

…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>
@python-cla-bot
Copy link

python-cla-bot bot commented Apr 28, 2025

All commit authors signed the Contributor License Agreement.

CLA signed

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