Skip to content

Multiple unused code warnings in Python/generated_cases.c.h #125515

@sobolevn

Description

@sobolevn

Bug report

Link: https://github.com/python/cpython/actions/runs/11333284963/job/31517440086#step:6:1025

Report:

 In file included from Python/ceval.c:870:
Python/generated_cases.c.h:5062:13: warning: code will never be executed [-Wunreachable-code]
            stack_pointer += -1;
            ^~~~~~~~~~~~~
Python/generated_cases.c.h:4748:13: warning: code will never be executed [-Wunreachable-code]
            stack_pointer += -1;
            ^~~~~~~~~~~~~
Python/generated_cases.c.h:803:31: warning: code will never be executed [-Wunreachable-code]
clang -c -fno-strict-overflow -Wsign-compare -Wunreachable-code -DNDEBUG -g -O3 -Wall    -D_Py_TIER2=1 -D_Py_JIT -flto=thin -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden -fprofile-instr-generate -I./Include/internal -I./Include/internal/mimalloc  -I. -I./Include    -DPy_BUILD_CORE -o Python/codegen.o Python/codegen.c
                for (int _i = oparg; --_i >= 0;) {
                              ^~~~~
Python/generated_cases.c.h:689:31: warning: code will never be executed [-Wunreachable-code]
                for (int _i = oparg*2; --_i >= 0;) {
                              ^~~~~

This looks like we have two different problems:

  1. stack manipulations are added after goto and return:
    GO_TO_INSTRUCTION(LOAD_SUPER_ATTR);
    stack_pointer += -1;
    assert(WITHIN_STACK_BOUNDS());
    and
    return PyStackRef_AsPyObjectSteal(retval);
    stack_pointer += -1;
    assert(WITHIN_STACK_BOUNDS());
  2. some logical? problem with the loop definition

CC @Fidget-Spinner

Linked PRs

Metadata

Metadata

Assignees

Labels

buildThe build process and cross-buildinterpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions