This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/12081] Gcc can't be compiled with -mregparm=3



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]