avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] Union as parameter


From: Larry Barello
Subject: [avr-gcc-list] Union as parameter
Date: Wed, 24 Aug 2005 00:19:08 -0700

I tried using this typedef, below, as a parameter to a function.  When I do,
it gets stuck onto the stack frame.  The resulting code is a riot since
there is all sorts of set up and teardown, the value gets stuck onto the
stack, the routine called, the variable pulled off the stack into registers
where it is acted upon.

Taking out the bitfield reverts to more normal GCC behavior: the union is
passed in a dword register set. An aside from some shuffling of registers is
pretty decent code.

Gcc 3.4.3 (latest WinAvr).

Is this a known issue?

Typedef union
{
        Uint32_t dword;
        Uint16_t word[2];
        Uint8_t byte[4];
        Struct
        {
                Uint16_t offset:7;
                Uint16_t page:10;
                Uint16_t bank:2;
        } bits;
}
Addr_u;

----
Larry Barello
www.barello.net 






reply via email to

[Prev in Thread] Current Thread [Next in Thread]