Skip to content

Build fails with --enable-pystats and --with-tail-call-interp due to undeclared lastopcode variable #132758

Closed

Description

@furkanonder

Bug report

Bug description:

When attempting to build CPython with both the --enable-pystats and --with-tail-call-interp options,
the build fails with errors about an undeclared identifier lastopcode.

Configuration

./configure CC=clang LD=clang --with-tail-call-interp --enable-pystats 

Build Output

In file included from Python/ceval.c:976:
Python/generated_cases.c.h:28:13: error: use of undeclared identifier 'lastopcode'
   28 |             INSTRUCTION_STATS(BINARY_OP);
      |             ^
Python/ceval_macros.h:66:48: note: expanded from macro 'INSTRUCTION_STATS'
   66 |         if (_Py_stats) _Py_stats->opcode_stats[lastopcode].pair_count[op]++; \
      |                                                ^
In file included from Python/ceval.c:976:
Python/generated_cases.c.h:28:13: error: use of undeclared identifier 'lastopcode'
Python/ceval_macros.h:67:9: note: expanded from macro 'INSTRUCTION_STATS'
   67 |         lastopcode = op; \
      |         ^
In file included from Python/ceval.c:976:
Python/generated_cases.c.h:93:13: error: use of undeclared identifier 'lastopcode'
   93 |             INSTRUCTION_STATS(BINARY_OP_ADD_FLOAT);
      |             ^
Python/ceval_macros.h:66:48: note: expanded from macro 'INSTRUCTION_STATS'
   66 |         if (_Py_stats) _Py_stats->opcode_stats[lastopcode].pair_count[op]++; \
      |                                                ^
In file included from Python/ceval.c:976:
Python/generated_cases.c.h:93:13: error: use of undeclared identifier 'lastopcode'
Python/ceval_macros.h:67:9: note: expanded from macro 'INSTRUCTION_STATS'
   67 |         lastopcode = op; \
      |         ^
In file included from Python/ceval.c:976:
Python/generated_cases.c.h:151:13: error: use of undeclared identifier 'lastopcode'
  151 |             INSTRUCTION_STATS(BINARY_OP_ADD_INT);
      |             ^
Python/ceval_macros.h:66:48: note: expanded from macro 'INSTRUCTION_STATS'
   66 |         if (_Py_stats) _Py_stats->opcode_stats[lastopcode].pair_count[op]++; \
      |                                                ^
In file included from Python/ceval.c:976:
Python/generated_cases.c.h:151:13: error: use of undeclared identifier 'lastopcode'
Python/ceval_macros.h:67:9: note: expanded from macro 'INSTRUCTION_STATS'
   67 |         lastopcode = op; \
      |         ^
In file included from Python/ceval.c:976:
Python/generated_cases.c.h:211:13: error: use of undeclared identifier 'lastopcode'
  211 |             INSTRUCTION_STATS(BINARY_OP_ADD_UNICODE);
      |             ^
Python/ceval_macros.h:66:48: note: expanded from macro 'INSTRUCTION_STATS'
   66 |         if (_Py_stats) _Py_stats->opcode_stats[lastopcode].pair_count[op]++; \
      |                                                ^
In file included from Python/ceval.c:976:
Python/generated_cases.c.h:211:13: error: use of undeclared identifier 'lastopcode'
Python/ceval_macros.h:67:9: note: expanded from macro 'INSTRUCTION_STATS'
   67 |         lastopcode = op; \
      |         ^
In file included from Python/ceval.c:976:
Python/generated_cases.c.h:271:13: error: use of undeclared identifier 'lastopcode'
  271 |             INSTRUCTION_STATS(BINARY_OP_EXTEND);
      |             ^
Python/ceval_macros.h:66:48: note: expanded from macro 'INSTRUCTION_STATS'
   66 |         if (_Py_stats) _Py_stats->opcode_stats[lastopcode].pair_count[op]++; \
      |                                                ^
In file included from Python/ceval.c:976:
Python/generated_cases.c.h:271:13: error: use of undeclared identifier 'lastopcode'
Python/ceval_macros.h:67:9: note: expanded from macro 'INSTRUCTION_STATS'
   67 |         lastopcode = op; \
      |         ^
In file included from Python/ceval.c:976:
Python/generated_cases.c.h:335:13: error: use of undeclared identifier 'lastopcode'
  335 |             INSTRUCTION_STATS(BINARY_OP_INPLACE_ADD_UNICODE);
      |             ^
Python/ceval_macros.h:66:48: note: expanded from macro 'INSTRUCTION_STATS'
   66 |         if (_Py_stats) _Py_stats->opcode_stats[lastopcode].pair_count[op]++; \
      |                                                ^
In file included from Python/ceval.c:976:
Python/generated_cases.c.h:335:13: error: use of undeclared identifier 'lastopcode'
Python/ceval_macros.h:67:9: note: expanded from macro 'INSTRUCTION_STATS'
   67 |         lastopcode = op; \
      |         ^
In file included from Python/ceval.c:976:
Python/generated_cases.c.h:418:13: error: use of undeclared identifier 'lastopcode'
  418 |             INSTRUCTION_STATS(BINARY_OP_MULTIPLY_FLOAT);
      |             ^
Python/ceval_macros.h:66:48: note: expanded from macro 'INSTRUCTION_STATS'
   66 |         if (_Py_stats) _Py_stats->opcode_stats[lastopcode].pair_count[op]++; \
      |                                                ^
In file included from Python/ceval.c:976:
Python/generated_cases.c.h:418:13: error: use of undeclared identifier 'lastopcode'
Python/ceval_macros.h:67:9: note: expanded from macro 'INSTRUCTION_STATS'
   67 |         lastopcode = op; \
      |         ^
In file included from Python/ceval.c:976:
Python/generated_cases.c.h:476:13: error: use of undeclared identifier 'lastopcode'
  476 |             INSTRUCTION_STATS(BINARY_OP_MULTIPLY_INT);
      |             ^
Python/ceval_macros.h:66:48: note: expanded from macro 'INSTRUCTION_STATS'
   66 |         if (_Py_stats) _Py_stats->opcode_stats[lastopcode].pair_count[op]++; \
      |                                                ^
In file included from Python/ceval.c:976:
Python/generated_cases.c.h:476:13: error: use of undeclared identifier 'lastopcode'
Python/ceval_macros.h:67:9: note: expanded from macro 'INSTRUCTION_STATS'
   67 |         lastopcode = op; \
      |         ^
In file included from Python/ceval.c:976:
Python/generated_cases.c.h:536:13: error: use of undeclared identifier 'lastopcode'
  536 |             INSTRUCTION_STATS(BINARY_OP_SUBSCR_DICT);
      |             ^
Python/ceval_macros.h:66:48: note: expanded from macro 'INSTRUCTION_STATS'
   66 |         if (_Py_stats) _Py_stats->opcode_stats[lastopcode].pair_count[op]++; \
      |                                                ^
In file included from Python/ceval.c:976:
Python/generated_cases.c.h:536:13: error: use of undeclared identifier 'lastopcode'
Python/ceval_macros.h:67:9: note: expanded from macro 'INSTRUCTION_STATS'
   67 |         lastopcode = op; \
      |         ^
In file included from Python/ceval.c:976:
Python/generated_cases.c.h:602:13: error: use of undeclared identifier 'lastopcode'
  602 |             INSTRUCTION_STATS(BINARY_OP_SUBSCR_GETITEM);
      |             ^
Python/ceval_macros.h:66:48: note: expanded from macro 'INSTRUCTION_STATS'
   66 |         if (_Py_stats) _Py_stats->opcode_stats[lastopcode].pair_count[op]++; \
      |                                                ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
clang -c -fno-strict-overflow -Wsign-compare -Wunreachable-code -DNDEBUG -g -O3 -Wall    -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden  -I./Include/internal -I./Include/internal/mimalloc  -I. -I./Include    -DPy_BUILD_CORE -o Python/context.o Python/context.c
20 errors generated.
make: *** [Makefile:3221: Python/ceval.o] Error 1
make: *** Waiting for unfinished jobs....

Environment

  • OS: Arch Linux (Linux 6.14.2-arch1-1)
  • Compiler: clang version 19.1.7

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

Activity

  1. added
    buildThe build process and cross-build
    type-bugAn unexpected behavior, bug, or error
    on Apr 20, 2025
  2. Fidget-Spinner commented on Apr 20, 2025

    @Fidget-Spinner
    Member

    Thanks! I put a PR up to fix this.

  3. added a commit that references this issue on Apr 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildThe build process and cross-buildtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions