[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Stack use - possible bug
From: |
Jan Waclawek |
Subject: |
Re: [avr-gcc-list] Stack use - possible bug |
Date: |
Wed, 9 Jun 2010 17:52:16 +0200 |
Wouter, that's it. I always tried the simplified examples using arrays of the
same size.
The following:
#include <stdint.h>
volatile uint8_t b;
int main (void) {
while(1) {
{
uint8_t a1[200];
b = a1[b];
}
{
uint8_t a2[210];
b = a2[b];
}
}
}
(The read to volatile uint8_t b is to prevent the optimiser to get rid of the
arrays altogether).
As a1[] and a2[] have limited scope/life in non-overlapping blocks, they may
and should use the same stack space.
However
11 main:
12 0000 DF93 push r29
13 0002 CF93 push r28
14 0004 CDB7 in r28,__SP_L__
15 0006 DEB7 in r29,__SP_H__
16 0008 CA59 subi r28,lo8(-(-410))
17 000a D140 sbci r29,hi8(-(-410))
i.e. stack frame of 200 + 210 bytes is used.
The inlined functions are only a variation of this problem.
Still I wouldn't call this a bug, but that's just terminology. Let's just call
it a serious case of missed optimisation... :-)
Jan Waclawek
Re: [avr-gcc-list] Stack use - possible bug, Dale, 2010/06/09
- Re: [avr-gcc-list] Stack use - possible bug, Paulo Marques, 2010/06/09
- Re: [avr-gcc-list] Stack use - possible bug, Dale, 2010/06/09
- RE: [avr-gcc-list] Stack use - possible bug, Weddington, Eric, 2010/06/09
- RE: [avr-gcc-list] Stack use - possible bug, Jan Waclawek, 2010/06/09
- Re: [avr-gcc-list] Stack use - possible bug, Wouter van Gulik, 2010/06/09
- Re: [avr-gcc-list] Stack use - possible bug,
Jan Waclawek <=
- Re: [avr-gcc-list] Stack use - possible bug, Wouter van Gulik, 2010/06/09
- Re: [avr-gcc-list] Stack use - possible bug, Jan Waclawek, 2010/06/09
- Re: [avr-gcc-list] Stack use - possible bug, Jan Waclawek, 2010/06/09
RE: [avr-gcc-list] Stack use - possible bug, Weddington, Eric, 2010/06/09
Re: [avr-gcc-list] Stack use - possible bug, Paulo Marques, 2010/06/09
RE: [avr-gcc-list] Stack use - possible bug, Colin O'Flynn, 2010/06/09
Re: [avr-gcc-list] Stack use - possible bug, Paulo Marques, 2010/06/09
RE: [avr-gcc-list] Stack use - possible bug, Weddington, Eric, 2010/06/09
Re: [avr-gcc-list] Stack use - possible bug, Jan Waclawek, 2010/06/09