Skip to content

Commit 94e7c92

Browse files
committed
gh-129259: Fix AIX build failures caused by incorrect struct alignment by adding AIX-specific #pragma pack directives.
1 parent 6579e03 commit 94e7c92

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

Include/internal/pycore_backoff.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ extern "C" {
1414
#include <stdint.h>
1515

1616

17+
#ifdef _AIX
18+
#pragma pack(push, 1)
19+
#endif
1720
typedef struct {
1821
union {
1922
struct {
@@ -23,6 +26,9 @@ typedef struct {
2326
uint16_t as_counter; // For printf("%#x", ...)
2427
};
2528
} _Py_BackoffCounter;
29+
#ifdef _AIX
30+
#pragma pack(pop)
31+
#endif
2632

2733

2834
/* 16-bit countdown counters using exponential backoff.

Include/internal/pycore_code.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ extern "C" {
2121
* 2**32 - 1, rather than INT_MAX.
2222
*/
2323

24+
#ifdef _AIX
25+
#pragma pack(push, 1)
26+
#endif
2427
typedef union {
2528
uint16_t cache;
2629
struct {
@@ -29,6 +32,9 @@ typedef union {
2932
} op;
3033
_Py_BackoffCounter counter; // First cache entry of specializable op
3134
} _Py_CODEUNIT;
35+
#ifdef _AIX
36+
#pragma pack(pop)
37+
#endif
3238

3339
#define _PyCode_CODE(CO) _Py_RVALUE((_Py_CODEUNIT *)(CO)->co_code_adaptive)
3440
#define _PyCode_NBYTES(CO) (Py_SIZE(CO) * (Py_ssize_t)sizeof(_Py_CODEUNIT))
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix AIX build failures caused by incorrect struct alignment in ``_Py_CODEUNIT``
2+
and ``_Py_BackoffCounter`` by adding AIX-specific ``#pragma pack`` directives.

0 commit comments

Comments
 (0)