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

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

Re: [avr-gcc-list] Problem with array on the stack


From: Cory Cross
Subject: Re: [avr-gcc-list] Problem with array on the stack
Date: Wed, 08 Sep 2010 11:23:14 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.19) Gecko/20081204 Iceape/1.1.14 (Debian-1.1.14-1)

Weddington, Eric wrote:
And what version are we talking about here?
Whoops, sorry: 4.3.5, from Debian unstable.

I will come up with a minimal test case.

Thanks,
Cory

-----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






reply via email to

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