On Jan 26, 2012, at 2:10 PM, Georg-Johann Lay wrote:

> I tested the code with avr-gcc 4.5 and command line options -Os -mmcu=atmega8
> 
> With the attributes, the object size is 54 bytes.
> Without the attributes the object size is 64 bytes.

4.5.3 ?  Whatever this issue is, it apparently snuck in between 4.5.2 and 4.5.3.
(reports are that 4.5.2 produced smaller code than 4.3.2)

Sorry for forgetting the commandline/etc in my report.  I am using -Os, and 
compiling for m328p

I get:

billw@VB-Ubuntu$ avr-gcc  -ggdb -Os -c -mmcu=atmega328p -mshort-calls foo.c
billw@VB-Ubuntu$ avr-size foo.o
   text    data     bss     dec     hex filename
     64       0       0      64      40 foo.o

billw@VB-Ubuntu$ avr-gcc  -ggdb -Os -c -mmcu=atmega328p -mshort-calls -DNAKED 
foo.c
billw@VB-Ubuntu$ avr-size foo.o
   text    data     bss     dec     hex filename
     58       0       0      58      3a foo.o

and more substantial diffs, including the following.  "naked" deletes the 
prolog, but adds instructions in the body...

-.LM7:
+.LSM6:
        ldi r24,lo8(5)
-       rjmp .L8
+       rcall putch
+       rjmp .L4
 .L3:
-.LM8:
+.LSM7:
        cpi r24,lo8(-127)
        brne .L5
-.LM9:
+.LSM8:
        ldi r24,lo8(4)
-       rjmp .L8
+       rcall putch
+       rjmp .L4
 .L5:
-.LM10:
+.LSM9:
        ldi r24,lo8(3)

Attachment: foo.c
Description: Binary data

_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
https://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to