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]

Re: GCC does not cope with my code





> 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

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