This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Frame pointer, bug or feature? (x86)
- From: Hendrik Greving <hendrik dot greving dot intel at gmail dot com>
- To: GCC Development <gcc at gcc dot gnu dot org>
- Date: Fri, 15 Nov 2013 09:31:54 -0800
- Subject: Frame pointer, bug or feature? (x86)
- Authentication-results: sourceware.org; auth=none
In the below test case, "CASE_A" actually uses a frame pointer, while
!CASE_A doesn't. I can't imagine this is a feature, this is a bug,
isn't it? Is there any reason the compiler couldn't know that
loop_blocks never needs a dynamic stack size?
#include <stdio.h>
#include <stdlib.h>
#define MY_DEFINE 100
#define CASE_A 1
extern init(int (*a)[]);
int
foo()
{
#if CASE_A
const int max = MY_DEFINE * 2;
int loop_blocks[max];
#else
int loop_blocks[MY_DEFINE * 2];
#endif
init(&loop_blocks);
return loop_blocks[5];
}
int
main()
{
int i = foo();
printf("is is %d\n", i);
}
Thanks,
Hendrik Greving