[3.14] gh-138264: Fix gcc 14 compiler warnings (GH-138265) (GH-138426)

(cherry picked from commit 4a33077fdb)
This commit is contained in:
Serhiy Storchaka 2025-10-07 23:26:05 +03:00 committed by GitHub
parent 537b558ce9
commit 9ec4e3838a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 23 additions and 23 deletions

View file

@ -77,7 +77,7 @@ PyAPI_FUNC(PyObject*) _Py_GetSpecializationStats(void);
#define RARE_EVENT_INTERP_INC(interp, name) \
do { \
/* saturating add */ \
int val = FT_ATOMIC_LOAD_UINT8_RELAXED(interp->rare_events.name); \
uint8_t val = FT_ATOMIC_LOAD_UINT8_RELAXED(interp->rare_events.name); \
if (val < UINT8_MAX) { \
FT_ATOMIC_STORE_UINT8(interp->rare_events.name, val + 1); \
} \

View file

@ -1601,7 +1601,7 @@ def test_instruction_size_macro(self):
frame->instr_ptr = next_instr;
next_instr += 1;
INSTRUCTION_STATS(OP);
frame->return_offset = 1 ;
frame->return_offset = 1u ;
DISPATCH();
}
"""

View file

@ -2355,7 +2355,7 @@ match_getindex(MatchObject* self, PyObject* index)
}
// Check that i*2 cannot overflow to make static analyzers happy
assert(i <= SRE_MAXGROUPS);
assert((size_t)i <= SRE_MAXGROUPS);
return i;
}

View file

@ -1576,7 +1576,7 @@
new_frame = _PyFrame_PushUnchecked(tstate, getitem, 2, frame);
new_frame->localsplus[0] = container;
new_frame->localsplus[1] = sub;
frame->return_offset = 6 ;
frame->return_offset = 6u ;
stack_pointer[-3].bits = (uintptr_t)new_frame;
stack_pointer += -2;
assert(WITHIN_STACK_BOUNDS());
@ -1944,8 +1944,8 @@
gen->gi_frame_state = FRAME_EXECUTING;
gen->gi_exc_state.previous_item = tstate->exc_info;
tstate->exc_info = &gen->gi_exc_state;
assert( 2 + oparg <= UINT16_MAX);
frame->return_offset = (uint16_t)( 2 + oparg);
assert( 2u + oparg <= UINT16_MAX);
frame->return_offset = (uint16_t)( 2u + oparg);
gen_frame->previous = frame;
stack_pointer[-1].bits = (uintptr_t)gen_frame;
break;
@ -4544,7 +4544,7 @@
gen->gi_exc_state.previous_item = tstate->exc_info;
tstate->exc_info = &gen->gi_exc_state;
gen_frame->previous = frame;
frame->return_offset = (uint16_t)( 2 + oparg);
frame->return_offset = (uint16_t)( 2u + oparg);
stack_pointer[0].bits = (uintptr_t)gen_frame;
stack_pointer += 1;
assert(WITHIN_STACK_BOUNDS());

View file

@ -653,7 +653,7 @@
new_frame = _PyFrame_PushUnchecked(tstate, getitem, 2, frame);
new_frame->localsplus[0] = container;
new_frame->localsplus[1] = sub;
frame->return_offset = 6 ;
frame->return_offset = 6u ;
}
// _PUSH_FRAME
{
@ -1586,7 +1586,7 @@
if (new_frame == NULL) {
JUMP_TO_LABEL(error);
}
frame->return_offset = 4 ;
frame->return_offset = 4u ;
DISPATCH_INLINED(new_frame);
}
STACKREFS_TO_PYOBJECTS(arguments, total_args, args_o);
@ -2641,7 +2641,7 @@
if (new_frame == NULL) {
JUMP_TO_LABEL(error);
}
assert( 1 == 1);
assert( 1u == 1);
frame->return_offset = 1;
DISPATCH_INLINED(new_frame);
}
@ -2922,8 +2922,8 @@
if (new_frame == NULL) {
JUMP_TO_LABEL(error);
}
assert( 4 == 1 + INLINE_CACHE_ENTRIES_CALL_KW);
frame->return_offset = 4 ;
assert( 4u == 1 + INLINE_CACHE_ENTRIES_CALL_KW);
frame->return_offset = 4u ;
DISPATCH_INLINED(new_frame);
}
STACKREFS_TO_PYOBJECTS(arguments, total_args, args_o);
@ -5821,7 +5821,7 @@
gen->gi_exc_state.previous_item = tstate->exc_info;
tstate->exc_info = &gen->gi_exc_state;
gen_frame->previous = frame;
frame->return_offset = (uint16_t)( 2 + oparg);
frame->return_offset = (uint16_t)( 2u + oparg);
}
// _PUSH_FRAME
{
@ -6460,7 +6460,7 @@
if (new_frame == NULL) {
JUMP_TO_LABEL(error);
}
frame->return_offset = 4 ;
frame->return_offset = 4u ;
DISPATCH_INLINED(new_frame);
}
STACKREFS_TO_PYOBJECTS(arguments, total_args, args_o);
@ -6681,7 +6681,7 @@
if (new_frame == NULL) {
JUMP_TO_LABEL(error);
}
assert( 1 == 1);
assert( 1u == 1);
frame->return_offset = 1;
DISPATCH_INLINED(new_frame);
}
@ -6832,8 +6832,8 @@
if (new_frame == NULL) {
JUMP_TO_LABEL(error);
}
assert( 4 == 1 + INLINE_CACHE_ENTRIES_CALL_KW);
frame->return_offset = 4 ;
assert( 4u == 1 + INLINE_CACHE_ENTRIES_CALL_KW);
frame->return_offset = 4u ;
DISPATCH_INLINED(new_frame);
}
STACKREFS_TO_PYOBJECTS(arguments, total_args, args_o);
@ -8237,7 +8237,7 @@
stack_pointer += -1;
assert(WITHIN_STACK_BOUNDS());
new_frame->localsplus[1] = PyStackRef_FromPyObjectNew(name);
frame->return_offset = 10 ;
frame->return_offset = 10u ;
DISPATCH_INLINED(new_frame);
}
@ -10690,8 +10690,8 @@
gen->gi_frame_state = FRAME_EXECUTING;
gen->gi_exc_state.previous_item = tstate->exc_info;
tstate->exc_info = &gen->gi_exc_state;
assert( 2 + oparg <= UINT16_MAX);
frame->return_offset = (uint16_t)( 2 + oparg);
assert( 2u + oparg <= UINT16_MAX);
frame->return_offset = (uint16_t)( 2u + oparg);
assert(gen_frame->previous == NULL);
gen_frame->previous = frame;
DISPATCH_INLINED(gen_frame);
@ -10791,8 +10791,8 @@
gen->gi_frame_state = FRAME_EXECUTING;
gen->gi_exc_state.previous_item = tstate->exc_info;
tstate->exc_info = &gen->gi_exc_state;
assert( 2 + oparg <= UINT16_MAX);
frame->return_offset = (uint16_t)( 2 + oparg);
assert( 2u + oparg <= UINT16_MAX);
frame->return_offset = (uint16_t)( 2u + oparg);
gen_frame->previous = frame;
}
// _PUSH_FRAME

View file

@ -443,7 +443,7 @@ def instruction_size(self,
"""Replace the INSTRUCTION_SIZE macro with the size of the current instruction."""
if uop.instruction_size is None:
raise analysis_error("The INSTRUCTION_SIZE macro requires uop.instruction_size to be set", tkn)
self.out.emit(f" {uop.instruction_size} ")
self.out.emit(f" {uop.instruction_size}u ")
return True
def _print_storage(self, reason:str, storage: Storage) -> None: