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

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

RE: [avr-gcc-list] Extremely confusing behaviour... (Suspectcompiler?,op


From: Ralph Mason
Subject: RE: [avr-gcc-list] Extremely confusing behaviour... (Suspectcompiler?,optimization error?)
Date: Thu, 15 May 2003 07:12:19 +1200

Unless the avr GCC documentation is incorrect, R18 & R19 are definitely call
used registers, and so are not preserved across the call.

It really doesn't matter what that function does, the fact it makes a call
and then uses r18 & r19 uninitalised is the problem.

Pretty scary bug.

Ralph

>
> It looks like the compiler assumes R18 & R19 are preserved across
> the call.  Isn't that
> a bug?  Gotta look at the assembly for srf08_read() to see what
> it does with those
> registers.
>
> ----- Original Message -----
> From: "Mike Panetta" <address@hidden>
> ...
> > retval = srf08_read(1, 0, pingdata, 2);
> >      1fe: 65 e0       ldi r22, 0x05 ; 5
> >      200: c6 2e       mov r12, r22
> >      202: d1 2c       mov r13, r1
> >      204: cc 0e       add r12, r28
> >      206: dd 1e       adc r13, r29
> >      208: 02 e0       ldi r16, 0x02 ; 2
> >      20a: 10 e0       ldi r17, 0x00 ; 0
> >      20c: 20 e0       ldi r18, 0x00 ; 0
> >      20e: 30 e0       ldi r19, 0x00 ; 0
> >      210: a6 01       movw r20, r12
> >      212: 60 e0       ldi r22, 0x00 ; 0
> >      214: 81 e0       ldi r24, 0x01 ; 1
> >      216: 0e 94 9c 04 call 0x938
> > PORTA &= ~(_BV(PA1));
> >      21a: d9 98       cbi 0x1b, 1 ; 27
> > PORTB = retval;
> >      21c: 68 bb       out 0x18, r22 ; 24
> > } while (retval != 2);
> >      21e: 60 17       cp r22, r16
> >      220: 71 07       cpc r23, r17
> >      222: 82 07       cpc r24, r18
> >      224: 93 07       cpc r25, r19
> >      226: 71 f6       brne .-100    ; 0x1c4
>
>
> _______________________________________________
> avr-gcc-list mailing list
> address@hidden
> http://www.avr1.org/mailman/listinfo/avr-gcc-list
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.480 / Virus Database: 276 - Release Date: 12/05/2003
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.480 / Virus Database: 276 - Release Date: 12/05/2003



reply via email to

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