This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/12081] Gcc can't be compiled with -mregparm=3
- From: "sam at rfc1149 dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Oct 2007 18:32:01 -0000
- Subject: [Bug target/12081] Gcc can't be compiled with -mregparm=3
- References: <bug-12081-1600@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #6 from sam at rfc1149 dot net 2007-10-27 18:32 -------
Here is a small test case for this program. Compile with -mregparm=3 (or any
value greater than 0 on x86).
#include <stdio.h>
typedef void (*func) (int a, ...);
void f (int a, int b)
{
printf ("a = %d, b = %d\n", a, b);
}
int main ()
{
func g = (void *) f;
g (1, 2);
return 0;
}
The execution on my machine prints:
a = 134513524, b = -1078190752
instead of the expected
a = 1, b = 2
obtained when using -mregparm=0.
The call to "f" (through variable "g") is generated as-is:
movl $2, 4(%esp)
movl $1, (%esp)
call f
instead of using registers.
--
sam at rfc1149 dot net changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |sam at rfc1149 dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12081