https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119536

            Bug ID: 119536
           Summary: [15 regression] Python fails to build (error: cannot
                    tail-call: call invocation refers to locals)
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Keywords: tail-call
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sjames at gcc dot gnu.org
  Target Milestone: ---

Created attachment 60923
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=60923&action=edit
ceval.i.xz

```
$ git clone https://github.com/python/cpython && cd cpython
$ ./configure --with-tail-call-interp
$ make
$ gcc -c -fno-strict-overflow -Wsign-compare -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/ceval.o Python/ceval.c
[...]
Python/generated_cases.c.h: In function ‘_TAIL_CALL_LOAD_FROM_DICT_OR_DEREF’:
Python/ceval_macros.h:89:32: error: cannot tail-call: call invocation refers to
locals
   89 |             Py_MUSTTAIL return (_TAIL_CALL_##name)(TAIL_CALL_ARGS); \  
                                                                               
                                |                               
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Python/generated_cases.c.h:8944:17: note: in expansion of macro ‘JUMP_TO_LABEL’
 8944 |                 JUMP_TO_LABEL(error);
      |                 ^~~~~~~~~~~~~
Python/ceval_macros.h:89:32: error: cannot tail-call: call invocation refers to
locals
   89 |             Py_MUSTTAIL return (_TAIL_CALL_##name)(TAIL_CALL_ARGS); \
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Python/generated_cases.c.h:8953:21: note: in expansion of macro ‘JUMP_TO_LABEL’
 8953 |                     JUMP_TO_LABEL(error);
      |                     ^~~~~~~~~~~~~
Python/ceval_macros.h:85:50: error: cannot tail-call: call invocation refers to
locals
   85 |             Py_MUSTTAIL return
(INSTRUCTION_TABLE[opcode])(TAIL_CALL_ARGS); \                                 
                                                                         |     
                          ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
Python/ceval_macros.h:146:9: note: in expansion of macro ‘DISPATCH_GOTO’
  146 |         DISPATCH_GOTO(); \
      |         ^~~~~~~~~~~~~
Python/generated_cases.c.h:8965:13: note: in expansion of macro ‘DISPATCH’
 8965 |             DISPATCH();
      |             ^~~~~~~~
[...]
```

---

```
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/15/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-pc-linux-gnu
Configured with:
/var/tmp/portage/sys-devel/gcc-15.0.9999/work/gcc-15.0.9999/configure
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr
--bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/15
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/15/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/15
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/15/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/15/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15
--disable-silent-rules --disable-dependency-tracking
--with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/15/python
--enable-libphobos --enable-objc-gc
--enable-languages=c,c++,d,go,objc,obj-c++,fortran,ada,cobol,m2,rust
--enable-obsolete --enable-secureplt --disable-werror --with-system-zlib
--enable-nls --without-included-gettext --disable-libunwind-exceptions
--enable-checking=yes,extra,rtl --with-bugurl=https://bugs.gentoo.org/
--with-pkgversion='Gentoo Hardened 15.0.9999 p, commit
c2b5b58acd2b0240ed361bbc9a94bf61d2d26f8e' --with-gcc-major-version-only
--enable-libstdcxx-time --enable-lto --disable-libstdcxx-pch --enable-shared
--enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
--enable-multilib --with-multilib-list=m32,m64 --disable-fixed-point
--enable-targets=all --enable-offload-defaulted
--enable-offload-targets=nvptx-none --enable-libgomp --disable-libssp
--enable-libada --disable-cet --disable-systemtap --enable-valgrind-annotations
--disable-vtable-verify --disable-libvtv --with-zstd --with-isl
--disable-isl-version-check --enable-default-pie --enable-host-pie
--enable-host-bind-now --enable-default-ssp --disable-fixincludes
--with-gxx-libcxx-include-dir=/usr/include/c++/v1
--with-build-config='bootstrap-O3 bootstrap-lto'
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 15.0.1 20250329 (experimental)
9018336252463ffed28f01badfdea2a3ca3ba5c8 (Gentoo Hardened 15.0.9999 p, commit
c2b5b58acd2b0240ed361bbc9a94bf61d2d26f8e)
```

Reply via email to