This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Frame pointer, bug or feature? (x86)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]