You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test_c_stack_unwind fails on Linux LoongArch builds #152240
On the Linux LoongArch64 platform, the test_c_stack_unwind test fails because CPython's manually implemented frame-pointer unwinding mechanism fails to recognize the LoongArch stack frame layout (as it relies on the default FRAME_POINTER_NEXT_OFFSET and FRAME_POINTER_RETURN_OFFSET). This issue affects builds using both GCC and Clang.
In the LoongArch architecture, the frame pointer points to the caller's stack pointer; the previous frame pointer is stored at fp[-2], and the return address is stored at fp[-1].
Additionally, for CPython builds compiled with Clang, unexpected failures occur in test sections involving the GNU backtrace() function. By default, Clang/LoongArch generates .debug_frame sections but does not generate the .eh_frame unwinding tables required for runtime unwinding of CPython's C objects. Consequently, glibc's backtrace() returns only a single stack frame and cannot unwind through Python stack frames.
Reproducer
GCC build:
../cpython/configure --with-pydebug CC=gcc
make -j8
PYTHON_JIT=0 ./python -m test -v test_c_stack_unwind
clang build:
../cpython/configure --with-pydebug CC=clang
make -j8
PYTHON_JIT=0 ./python -m test -v test_c_stack_unwind
Activity
StanFromIreland commentedon Jun 26, 2026
Related issues:
yzewei commentedon Jun 29, 2026
That's true; similar operations need to be performed for loongarch. Correct the offsets for obtaining sp and ra. #152241
pythongh-152240: Fix LoongArch frame pointer unwinding
pythongh-152240: Fix LoongArch frame pointer unwinding
gh-152240: Fix test_c_stack_unwind on Linux LoongArch builds (#152241)
pythongh-152240: Fix LoongArch frame pointer unwinding