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

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

[avr-gcc-list] Compilerbug ?


From: Markus Assfalg
Subject: [avr-gcc-list] Compilerbug ?
Date: Thu, 1 May 2003 13:47:41 +0200

Hi,

during a moduletest I found the following suspicious
(gcc generated) assembler code:

typedef struct
{
        INT32U          counter;
        INT8U           index;
        INT8U           state;
        TIMER_FUNC      *handler;
        INT32U          compare;
} TIMER_CHANNEL;

static  TIMER_CHANNEL   _tmr_ch[CHANNELS];

                        _tmr_ch[idx].counter++;
    10ae:       80 81           ld      r24, Z
    10b0:       91 81           ldd     r25, Z+1        ; 0x01
    10b2:       a2 81           ldd     r26, Z+2        ; 0x02
    10b4:       b3 81           ldd     r27, Z+3        ; 0x03
    10b6:       01 96           adiw    r24, 0x01       ; 1
                     adc r25,r1 <--- << should here, but isn't !
    10b8:       a1 1d           adc     r26, r1
    10ba:       b1 1d           adc     r27, r1
    10bc:       80 83           st      Z, r24
    10be:       91 83           std     Z+1, r25        ; 0x01
    10c0:       a2 83           std     Z+2, r26        ; 0x02
    10c2:       b3 83           std     Z+3, r27        ; 0x03

                        // overflow ?
                        if (_tmr_ch[idx].counter == 0)
    10c4:       00 97           sbiw    r24, 0x00       ; 0
                     cpc r25, r1        <--- << should here, but isn't !
    10c6:       a1 05           cpc     r26, r1
    10c8:       b1 05           cpc     r27, r1
    10ca:       91 f4           brne    .+36            ; 0x10f0
                        {
                                _tmr_ch[idx].state |= _CH_STATE_OVR;
    10cc:       21 60           ori     r18, 0x01       ; 1
    10ce:       25 83           std     Z+5, r18        ; 0x05

A bug ?
I use GCC 3.2.3

Markus


reply via email to

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