Hi all,

I had an array on the stack clobber a global array like so:

uint16_t clobberee[3] = {0xFFFF,0xFFFF,0xFFFF};

volatile uint8_t stuff[9][7];

void process(uint8_t num) {
  uint8_t i,j;
  for(i=0;i<num;++i){
    uint8_t clobberer[7];
    for(j=0;j<7;++j)
       clobberer[j] = stuff[0][j];
  }
}

When I made "clobberer" a global, everything worked fine. But with it on the stack there, the assembly loaded "0x0100" as the base address. When made a global, it used the global address and everything worked fine.

I'm using the flags -mmcu=atmega168 -I. -gstabs -Os -Wall -Wstrict-prototypes -fpack-struct -fshort-enums -std=gnu99 -save-temps -ffunction-sections -ffreestanding

If this is not my fault, I will try and come up with the simplist program demonstrating the problem.

Thanks,
Cory

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

Reply via email to