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

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

[avr-gcc-list] avr-gcc bug while initialising variables


From: Emil
Subject: [avr-gcc-list] avr-gcc bug while initialising variables
Date: Wed, 4 Aug 2004 00:08:41 +0100

int
main( void )
{
  unsigned char   s[8] = { 0x6E, 0x4E, 0xF7, 0x07, 0x41, 0xFA, 0xB9, 0xD4 };
  unsigned char   d[8] = { 0x1B, 0x55, 0x7C, 0xE6, 0x54, 0xAC, 0x54, 0xDB };
  return 0;
}

Compile it with version 3.4.0 and the following flags:
CPFLAGS = -mmcu=atmega16 -g -O3 -funsigned-char -funsigned-bitfields 
-fpack-struct -fshort-enums -Wall -W

The generated code looks like this:

  unsigned char   s[8] = { 0x6E, 0x4E, 0xF7, 0x07, 0x41, 0xFA, 0xB9, 0xD4 };
  96:   88 e0           ldi     r24, 0x08       ; 8
  98:   a0 e6           ldi     r26, 0x60       ; 96
  9a:   b0 e0           ldi     r27, 0x00       ; 0
  9c:   fe 01           movw    r30, r28
  9e:   31 96           adiw    r30, 0x01       ; 1
  a0:   0d 90           ld      r0, X+          
  a2:   01 92           st      Z+, r0
  a4:   8a 95           dec     r24
  a6:   e1 f7           brne    .-8             ; 0xa0
  unsigned char   d[8] = { 0x1B, 0x55, 0x7C, 0xE6, 0x54, 0xAC, 0x54, 0xDB };
  a8:   a8 e6           ldi     r26, 0x68       ; 104
  aa:   b0 e0           ldi     r27, 0x00       ; 0
  ac:   fe 01           movw    r30, r28
  ae:   39 96           adiw    r30, 0x09       ; 9
  b0:   0d 90           ld      r0, X+
  b2:   01 92           st      Z+, r0
  b4:   8a 95           dec     r24
  b6:   e1 f7           brne    .-8             ; 0xb0

For the second initialisation there is a "ldi r24, 0x08" instruction 
missing from the code.

-- 
                                                                Regards,
                                                                Emil
--
Mistress: (n) the thing that comes between a mister and a mattress.


reply via email to

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