Compiling the attached file fails with '-fno-enforce-eh-specs -O2', even with gigabytes of RAM and swap. After a few hours it says: cc1plus: out of memory allocating 1643995136 bytes after a total of 94982144 bytes It used to be fine with gcc 3.4.
Created attachment 117321 [details] offending C++ file.
My guess is this is about inlining heuristics, with -O2 -fno-enforce-eh-specs it creates a really huge function (almost 60000 basic blocks) and that obviously then takes a lot of time and memory to process. The inling heuristics have been changed again in 4.1 (it is tweaked between all GCC releases). If you use -Os -fno-enforce-eh-specs, it compiles almost instantly.
I don't think it is a good idea to mess with GCC 4.0 inlining heuristics at this point. FC5 will very likely include GCC 4.1.