Qeustion about the optimize option

Victor vic7tor@gmail.com
Tue May 10 10:23:00 GMT 2011


I want to build the linux kernel at O0 optimize level. The first problem
that I face was something about constant.
I have study it for a day time, but it haven't sovled.
There is the problem.

#include <stdio.h>

int main()
{
        int *map;
        const size_t size = 128 * sizeof(map[0]);

        ((void)(sizeof(struct { int:-!!(size > ((1UL) << 12)); })));
}

When I compile this program use gcc test.c, it fail with
test.c: In function ‘main’:
test.c:8:24: error: bit-field ‘<anonymous>’ width not an integer
constant

When I compile this program use gcc test.c -O, it success.

Because I want to debug the linux kernel, how can compile the test
program above don't use O1 O2 O3.

Thanks.



More information about the Gcc-help mailing list