Skip to content
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

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

Open
sobolevn opened this issue Oct 15, 2024 · 1 comment
Open

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

sobolevn opened this issue Oct 15, 2024 · 1 comment
Assignees
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error

Comments

@sobolevn
Copy link
Member

sobolevn commented Oct 15, 2024

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

@markshannon
Copy link
Member

I'm not sure what we can do about the compiler compiling about

if (CONVERSION_FAILED(x)) {
   ... // compiler complains this is unreachable
}

as CONVERSION_FAILED(x) is #defined as 0 in the with-gil build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

2 participants