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

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

Re: [avr-gcc-list] Compiler error


From: Dmitry K.
Subject: Re: [avr-gcc-list] Compiler error
Date: Mon, 23 May 2005 17:46:19 +1100
User-agent: KMail/1.5

On Monday 23 May 2005 15:01, Larry Barello wrote:
> 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];
> }

bar.byte[3]  <-- index too big.

Regards.





reply via email to

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