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

            Bug ID: 120840
           Summary: CPython miscompiled with preserve_none
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sjames at gcc dot gnu.org
                CC: hjl.tools at gmail dot com, kenjin4096 at gmail dot com
  Target Milestone: ---

>From https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119628#c24 ...

(In reply to H.J. Lu from comment #24)
> How do I reproduce it?  Do you have a step-by-step guide?  Thanks.

$ git clone https://github.com/python/cpython
$ git rev-parse HEAD
34ce1920ca33c11ca2c379ed0ef30a91010bef4f
$ ./configure --with-tail-call-interp
$ make -j$(nproc) -l$(nproc)
[...]
./_bootstrap_python ./Programs/_freeze_module.py codecs ./Lib/codecs.py
Python/frozen_modules/codecs.h
*** stack smashing detected ***: terminated
make: *** [Makefile:1912: Python/frozen_modules/codecs.h] Aborted (core dumped)
make: *** Waiting for unfinished jobs....
./_bootstrap_python ./Programs/_freeze_module.py posixpath ./Lib/posixpath.py
Python/frozen_modules/posixpath.h
*** stack smashing detected ***: terminated
make: *** [Makefile:1930: Python/frozen_modules/posixpath.h] Aborted (core
dumped)
./_bootstrap_python ./Programs/_freeze_module.py abc ./Lib/abc.py
Python/frozen_modules/abc.h
*** stack smashing detected ***: terminated
make: *** [Makefile:1909: Python/frozen_modules/abc.h] Aborted (core dumped)

$ gdb --args ./_bootstrap_python ./Programs/_freeze_module.py codecs
./Lib/codecs.py Python/frozen_modules/codecs.h
Reading symbols from ./_bootstrap_python...
(gdb) r
Starting program: /tmp/cpython/_bootstrap_python ./Programs/_freeze_module.py
codecs ./Lib/codecs.py Python/frozen_modules/codecs.h
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib64/libthread_db.so.1".
*** stack smashing detected ***: terminated

Program received signal SIGABRT, Aborted.
__pthread_kill_implementation (threadid=<optimized out>, signo=6, no_tid=0) at
pthread_kill.c:44
44            return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO
(ret) : 0;
(gdb) bt
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=6, no_tid=0)
at pthread_kill.c:44
#1  __pthread_kill_internal (threadid=<optimized out>, signo=6) at
pthread_kill.c:89
#2  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at
pthread_kill.c:100
#3  0x00007ffff7c20dc2 in __GI_raise (sig=sig@entry=6) at
../sysdeps/posix/raise.c:26
#4  0x00007ffff7c01383 in __GI_abort () at abort.c:73
#5  0x00007ffff7c0258a in __libc_message_impl (fmt=fmt@entry=0x7ffff7de0816
"*** %s ***: terminated\n") at ../sysdeps/posix/libc_fatal.c:134
#6  0x00007ffff7d28747 in __GI___fortify_fail (msg=msg@entry=0x7ffff7de082e
"stack smashing detected") at fortify_fail.c:24
#7  0x00007ffff7d29942 in __stack_chk_fail () at stack_chk_fail.c:24
#8  0x0000555555761b67 in _PyEval_EvalFrameDefault (tstate=<optimized out>,
frame=<optimized out>, throwflag=<optimized out>) at Python/ceval.c:1238
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Reply via email to