Michal Trojnara wrote:
What about the number of arguments? Why isn't "1" correct?
Assume the traditional way of passing arguments on stack, with "int" naturally aligned. Then makecontext does something like this: - set stack pointer to "top" - argc * sizeof(int) - copy argc * sizeof (int) bytes from makecontext() arguments to stack - set up the rest of the frame
If sizeof (void *) > sizeof (int), which happens on 64-bit platforms, the above doesn't copy the whole value of the pointer when argc == 1. Mirek