This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: x86 64 bit function argument bug?,..
Stephen Biggs <xyzzy@hotpop.com> writes:
> #include <stdio.h>
> void f(unsigned int *p) {
> printf("%x\n", *p);
> }
> void g(unsigned long long x,...) {
> f((unsigned int *)(((char *)&x)+sizeof(x)));
> }
> int main(void) {
> g(0x1122334455667788ULL,0x11223344U);
> }
>
> ... you would get bogus results, if not a crash, because it is taking
> the address of the quantity on the stack previous to the call instead of
> the current argument list.
But this is clearly invalid C, and I'm pretty certain we don't want to
support this as an extension, either. So I guess you're out of luck.
--
Falk