x86 64 bit function argument bug?
Falk Hueffner
falk.hueffner@student.uni-tuebingen.de
Sun May 4 16:02:00 GMT 2003
Stephen Biggs <xyzzy@hotpop.com> writes:
> On Sun, 2003-05-04 at 11:54, Falk Hueffner wrote:
> > Stephen Biggs <xyzzy@hotpop.com> writes:
> > > I want to take an address of an argument and dereference it to
> > > access the value that is passed to a function on the stack.
> >
> > That should work just fine. If it doesn't, it's a bug.
>
> Ah, now we understand each other. I am saying that the x86 behavior
> for 64 bit value arguments is a bug.
Maybe you can provide a test case without undefined behaviour that
shows this?
#include <stdio.h>
void f(unsigned long long *p) {
printf("%llx\n", *p);
}
void g(unsigned long long x) {
f(&x);
}
int main(void) {
g(0x1122334455667788ULL);
}
works for me.
> > > Basically I am trying to do varargs/stdarg without using varargs or
> > > any built-in functions.
> >
> > That is impossible to do portably.
>
> Granted. I would be satisfied with it working in GCC, and it does on
> the x86 except for 64 bit values.
I'm pretty sure that is still impossible, unless you also restrict
yourself to the x86 architecture.
--
Falk
More information about the Gcc
mailing list