C
Colin Walters
Hi,
I have a program which had a little function that always returned TRUE,
it looked like this:
int
always_true_function (void *dummy, ...)
{
return 1;
}
Now, at one point I was calling this via a function pointer that was
defined without the varargs, like this:
typedef int (*testfunc) (void *dummy);
int
main (int argc, char **argv)
{
testfunc f = (testfunc) always_true_function;
if (f (NULL))
return 0;
return 1;
}
This all worked fine up until recently, when I heard from one user who was
trying to run the program on AMD64 was getting very mysterious segfaults.
On my machine (i386, gcc 3.3.2), the above test program works fine. On
his machine (AMD64, gcc 3.3.2 + propolice patch), it segfaults.
It turned out I didn't actually need the varargs, but I'm curious - who is
at fault here? Is my code wrong, or is his gcc broken?
I have a program which had a little function that always returned TRUE,
it looked like this:
int
always_true_function (void *dummy, ...)
{
return 1;
}
Now, at one point I was calling this via a function pointer that was
defined without the varargs, like this:
typedef int (*testfunc) (void *dummy);
int
main (int argc, char **argv)
{
testfunc f = (testfunc) always_true_function;
if (f (NULL))
return 0;
return 1;
}
This all worked fine up until recently, when I heard from one user who was
trying to run the program on AMD64 was getting very mysterious segfaults.
On my machine (i386, gcc 3.3.2), the above test program works fine. On
his machine (AMD64, gcc 3.3.2 + propolice patch), it segfaults.
It turned out I didn't actually need the varargs, but I'm curious - who is
at fault here? Is my code wrong, or is his gcc broken?