Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

在vintage/context/test_swap.cpp中的raw_thread函数打印浮点数时,会segmentation fault

Open
#2 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
30/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp

Research direction

Start in vintage/context/test_swap.cpp at raw_thread and the ctx_swapcontext calls. Reproduce the crash when printf formats the float, then compare the custom context swap with the POSIX ucontext behavior and inspect the FPU environment handling noted in the issue. Done means the floating-point print returns without a segmentation fault.

Written by the indexing model from the issue text.

Description

可如下复现:

int raw_thread(voidp) {
float pi = 3.14;
printf("remote: hello %s\n", (char
)p);
ctx_swapcontext(&cc, &mc);
printf("remote: back again\n");
ctx_swapcontext(&cc, &mc);
printf("remote: return, %f\n", pi);
return 1024;
}

切换为posix ucontext系列函数不会core。
从glibc源码看,都使用的FNSTENV保存FPU的环境信息;
gdb 查看,core在printf中:
movaps %xmm0, 0x50(%rsp)

Dominant language
Python
Stars
43
Forks
20
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from skywind3000/collection

All issues in skywind3000/collection

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.