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

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

[avr-gcc-list] Compiler error


From: Larry Barello
Subject: [avr-gcc-list] Compiler error
Date: Sun, 22 May 2005 21:01:47 -0700

Before I submit a bug report, is this old news?  If the union is aligned
(e.g. the byte array is the same length as the union object) the compiler is
happy.  Make them different and it ICE.  Put the union on the stack and the
problem goes away.  It seems to be associated with the inline asm.

---- snip here ----
#include <inttypes.h>
uint8_t foo (uint8_t baz)
{
        union
        {
                uint16_t word;
                uint8_t byte[3];
        }
        bar;
        bar.byte[0] = baz;
        asm volatile (
                "\tadd  %A0, %A0\n"
                "\tadc  %B0, %B0\n"
                "\tadc  %C0, %C0\n"
                : :"r" (bar) );

        return bar.byte[3];
}



----
Larry Barello
http://www.barello.net

Attachment: foo.c
Description: Binary data


reply via email to

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