Andreas Schwab <sch...@linux-m68k.org> writes:

> Dennis Clarke <dcla...@blastwave.org> writes:
>
>>      for (argno = 0; argno < argc; argno++) {
>>              if (argno < 6)
>>                      *tsp++ = reg[REG_O0 + argno] = va_arg(ap, long);
>>              else
>>                      *tsp++ = va_arg(ap, long);
>
> This is broken.  The arguments are of type int, not long.

I suspect that the error of using "int" is one of the reasons why
makecontext has been removed from POSIX.  Thought I don't know why it
was not replaced with a proper version.

In this case, where the arguments are passed via registers anyhow, using
long rather than int will always work for int, and will additionally
work for void*, so using long is a good practical choice: it will work
for correct code, and will make incorrect code which uses pointers more
likely to work.

Ian

Reply via email to