[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] avr-gcc (GCC) 3.4.5 Bug: copying structure through po
From: |
Dmitry K. |
Subject: |
Re: [avr-gcc-list] avr-gcc (GCC) 3.4.5 Bug: copying structure through pointer will destroy the pointer |
Date: |
Tue, 7 Feb 2006 08:15:40 +1000 |
User-agent: |
KMail/1.5 |
On Tuesday 07 February 2006 07:24, Joerg Wunsch wrote:
> address@hidden wrote:
> > I must have mixed up some of my testing results. Thanks to
> > lfmorrison from AVRfreaks.
>
> Here's the smallest reproducible test case:
>
> #define STRUCTSIZE 5
> struct a {
> char z[STRUCTSIZE];
> };
>
> extern struct a *ap;
> extern struct a b;
>
> void
> bug(void)
> {
> *ap++ = b;
> }
Avr-gcc 3.3.5 is correct:
lds r24,ap
lds r25,(ap)+1
ldi r18,lo8(5)
mov r31,r25
mov r30,r24
ldi r26,lo8(b)
ldi r27,hi8(b)
ld __tmp_reg__,X+
st Z+,__tmp_reg__
dec r18
brne .-8
adiw r24,5
sts (ap)+1,r25
sts ap,r24
Dmitry.