[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [avr-gcc-list] Problem with array on the stack
From: |
Weddington, Eric |
Subject: |
RE: [avr-gcc-list] Problem with array on the stack |
Date: |
Mon, 6 Sep 2010 17:07:24 -0600 |
And what version are we talking about here?
> -----Original Message-----
> From:
> address@hidden
> [mailto:address@hidden
> org] On Behalf Of Cory Cross
> Sent: Monday, September 06, 2010 4:47 PM
> To: address@hidden
> Subject: [avr-gcc-list] Problem with array on the stack
>
> 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
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
>