Skip to content

3.14.0b2 fails to build with strictly C11 compliant compiler #134875

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

Closed
jmroot opened this issue May 29, 2025 · 4 comments
Closed

3.14.0b2 fails to build with strictly C11 compliant compiler #134875

jmroot opened this issue May 29, 2025 · 4 comments
Assignees
Labels
3.14 bugs and security fixes 3.15 new features, bugs and security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error

Comments

@jmroot
Copy link
Contributor

jmroot commented May 29, 2025

Bug report

Bug description:

With a compiler that implements atomic_load_explicit as specified in the C11 standard (such as many older versions of clang), Python 3.14.0b2 fails to build:

In file included from Parser/pegen.c:3:
In file included from ./Include/internal/pycore_pystate.h:12:
In file included from ./Include/internal/pycore_tstate.h:13:
In file included from ./Include/internal/pycore_mimalloc.h:45:
./Include/internal/mimalloc/mimalloc/internal.h:640:23: error: address argument to atomic operation must be a pointer to non-const _Atomic type ('const _Atomic(mi_encoded_t) *' invalid)
  next = (mi_block_t*)mi_atomic_load_relaxed(&block->next);
                      ^                      ~~~~~~~~~~~~
./Include/internal/mimalloc/mimalloc/atomic.h:61:50: note: expanded from macro 'mi_atomic_load_relaxed'
#define mi_atomic_load_relaxed(p)                mi_atomic(load_explicit)(p,mi_memory_order(relaxed))
                                                 ^                        ~
./Include/internal/mimalloc/mimalloc/atomic.h:42:33: note: expanded from macro 'mi_atomic'
#define  mi_atomic(name)        atomic_##name
                                ^
<scratch space>:40:1: note: expanded from here
atomic_load_explicit
^

Using const here wasn't allowed until C17: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_459

This is a regression since b1.

CPython versions tested on:

3.14

Operating systems tested on:

macOS

Linked PRs

@jmroot jmroot added the type-bug An unexpected behavior, bug, or error label May 29, 2025
@jmroot
Copy link
Contributor Author

jmroot commented May 29, 2025

Looks like this is an unintended consequence of 317c496. @corona10

@corona10 corona10 self-assigned this May 29, 2025
@corona10
Copy link
Member

Which compiler version are you using?

@jmroot
Copy link
Contributor Author

jmroot commented May 29, 2025

This build was with Apple Clang 902.0.39.2.

@ZeroIntensity ZeroIntensity added interpreter-core (Objects, Python, Grammar, and Parser dirs) 3.14 bugs and security fixes 3.15 new features, bugs and security fixes labels May 29, 2025
corona10 added a commit to corona10/cpython that referenced this issue Jun 1, 2025
@corona10
Copy link
Member

corona10 commented Jun 1, 2025

@jmroot Would you like to test to build with #134994 ?

miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jun 2, 2025
…ngh-134994)

(cherry picked from commit b525e31)

Co-authored-by: Donghee Na <donghee.na@python.org>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jun 2, 2025
…ngh-134994)

(cherry picked from commit b525e31)

Co-authored-by: Donghee Na <donghee.na@python.org>
corona10 added a commit that referenced this issue Jun 3, 2025
…34994) (gh-135053)

gh-134875: Fix mimallc build error for the old compilers (gh-134994)
(cherry picked from commit b525e31)

Co-authored-by: Donghee Na <donghee.na@python.org>
corona10 added a commit that referenced this issue Jun 3, 2025
…34994) (gh-135054)

gh-134875: Fix mimallc build error for the old compilers (gh-134994)
(cherry picked from commit b525e31)

Co-authored-by: Donghee Na <donghee.na@python.org>
@corona10 corona10 closed this as completed Jun 3, 2025
@corona10 corona10 reopened this Jun 3, 2025
@corona10 corona10 closed this as completed Jun 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.14 bugs and security fixes 3.15 new features, bugs and security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

3 participants