This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GCC does not cope with my code
- To: Gunnar Braun <braung at ert dot rwth-aachen dot de>
- Subject: Re: GCC does not cope with my code
- From: Eric Christopher <echristo at cygnus dot com>
- Date: Wed, 24 May 2000 11:34:42 -0700
- CC: gcc at gcc dot gnu dot org
- References: <392BA276.A926D2B3@ert.rwth-aachen.de>
> I'm currently developing tools that generate C++ code. The generated
> code contains a bunch of macros which are expanded by the preprocessor.
> No problem up to here. Now I'd like to compile the resulting file with
> g++, but it takes ages until I get the object file. It gets worse, if I
> try to optimize the code generation via -O (of course it gets). The
> problem is that the (source) file (after the macro expansion) isn't
> really large, it's below 700 kB. If the file gets above 700 kB, the
> compiler crashes with the famous signal 11 internal compiler error.
>
> What is wrong with the generated source file that the compiler doesn't
> cope with it?
Nothing is wrong per se, but the switch statements are really large.
Especially in the optimized case it is allocating huge vectors of
memory.
>
> or:
>
> What changes can I apply to the _code_ to reduce compile time/make it
> possible to compile the file?
>
Break up the switch statements if possible. Break them into functions
and then have smaller switch statements inside would be an idea.
-eric