This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Go in gcc 4.7
- From: Ian Lance Taylor <iant at google dot com>
- To: Andreas Schwab <schwab at linux-m68k dot org>
- Cc: dclarke at blastwave dot org, Joel Sherrill <joel dot sherrill at oarcorp dot com>, Rainer Orth <ro at cebitec dot uni-bielefeld dot de>, "gcc\ at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>, "gofrontend-dev\ at googlegroups dot com" <gofrontend-dev at googlegroups dot com>
- Date: Fri, 13 Jan 2012 09:16:23 -0800
- Subject: Re: Go in gcc 4.7
- References: <53360.10.0.66.17.1326403782.squirrel@interact.purplecow.org> <m2k44w9ct6.fsf@igel.home>
Andreas Schwab <schwab@linux-m68k.org> writes:
> Dennis Clarke <dclarke@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