bugAVR C Runtime Library - Bugs: bug #20092, AVR-GCC code size increase from...


bug #20092: AVR-GCC code size increase from 3.4.6 to 4.1.2

Submitted by:  None
Submitted on:  Wed 06 Jun 2007 02:33:54 AM UTC  
Category:  None Severity:  3 - Normal
Priority:  3 - Low Item Group:  None
Status:  Invalid Assigned to:  Joerg Wunsch <joerg_wunsch>
Percent Complete:  0% Originator Email:  -email is unavailable-
Open/Closed:  Closed Release:  None
Fixed Release:  None

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Tue 23 Oct 2007 01:44:40 PM UTC, comment #1: 

Except for perhaps the EEPROM code, avr-libc is entirely the
wrong addressee for this.  For the EEPROM code, we might be
the correct one to handle it, provided:

. we get more details (it's not even clear what `size' is
  meant below, the size of the hex file?, the number of ROM
  bytes? -- I cannot reproduce any of these figures, not
  even closely)

. it turns out the regression is actually within avr-libc's
  domain, e.g. in an assembly source file -- if the compiler
  compiles C code into less optimal assembly, this is nothing
  the avr-libc folks could fix

As for the compiler changes itself, the only thing I'm immediately
aware of is that main() is now treated as a normal function,
so it gets prologue/epilogue code.  This can be avoided by
declaring it `naked' first:

int main(void) _attribute_((naked));
main(void) {

(A more appropriate attribute is in the works, this will
be the equivalent of other compilers' __C_task keyword.)

If you've got more details, and clear sample code that
allows others to reproduce and identify the optimization
regression, please open a WinAVR bug report for this.

Joerg Wunsch <joerg_wunsch>
Project AdministratorIn charge of this item.
Wed 06 Jun 2007 02:33:54 AM UTC, original submission:  

Additional code size introduced in AVR-GCC compiler 4.1.2 as packaged in WinAVR-20070525 and as compared to 3.4.6 packaged in WinAVR-20060421

All examples targeting ATTiny2313 using AVRStudio 4.13
My original program compiled to 1990 bytes, recompiled under 4.1.2  increased to 2070 bytes (exceeding ATTiny2313 capacity).

Some specific functions causing issues detailed below:

Bare main function:

  int main( void )

WinAVR-20060421 102 bytes
WinAVR-20070525 108 bytes
+6 bytes

EEPROM code:

  #include <avr/eeprom.h>

  struct {
    int x;
  } ee;

  // Main - a simple test program
  int main( void )
    unsigned char *eeptr=0x0000;
    eeprom_read_block(&ee, eeptr, sizeof(ee));

WinAVR-20060421 196 bytes
WinAVR-20070525 218 bytes
+16 bytes


  #include <avr/pgmspace.h>

  int main(void){
    PGM_P defaults =   PSTR("123456");

WinAVR-20060421 118 bytes
WinAVR-20070525 148 bytes
+24 bytes



(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by joerg_wunsch (Posted a comment)
  • -email is unavailable- added by arcanum (Updated the item)



    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2007-10-23 joerg_wunsch StatusNone => Invalid
        Assigned toNone => joerg_wunsch
        Open/ClosedOpen => Closed
    2007-09-12 arcanum Priority5 - Normal => 3 - Low

    Back to the top

    Powered by Savane 3.5