Date: Wed, 5 Nov 1997 19:45:50 -0800 (PST) Message-Id: <199711060345.TAA03134@adit.ap.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" To: d DOT pearson AT EXT DOT canterbury DOT ac DOT nz, djgpp AT delorie DOT com From: Nate Eldredge Subject: Re: G++ can't optimise my code! Precedence: bulk At 02:29 11/6/1997 +1200, Davin Pearson wrote: >I find it hard to believe that very many people seriously >use G++. On many occaisons it has barked something like this: > >cd ~/skid/ >make run CCOPT=-O2 >gcc -c -O2 main.cc -o main.o >axle.h: In method `void Car::evolve()': >In file included from main.cc:8: >axle.h:273: Internal compiler error. >axle.h:273: Please submit a full bug report to >`bug-g++@prep.ai.mit.edu'. >make.exe: *** [main.o] Error 1 > >Having just read the DJGPP FAQ on this problem, I can report having no >joy with -fno-strength-reduce, and "gcc -v" says version 2.7.2. Here's my experience: The code compiled okay on my machine. I am using GCC 2.7.2.1, with `cc1plus.exe' stubedited to 1MB of stack. (Also, I'm using Allegro 2.2.) But, it took almost 2 minutes to compile (P133, 16MB ram, 8MB free after ramdisk, cache, etc). Adding `-dm' to the compiler command line revealed that it took about 22 MB of memory (!). This seems to be a pathological case, since it doesn't seem to be a particularly complicated source. I would try either upgrading to 2.7.2.1, or stubediting `cc1plus' to a larger stack, or both. Stack overflow can, IIRC, cause `Internal Compiler Error'. > >I have submitted a similar bug report in the past (Having tracked down >that bug to a particular construct), only to receive no >acknowledgement of my bug report! The GCC/G++ maintainers are very busy, and frequently don't respond to bug reports. Did you give them all the details and a preprocessed file, like the manual says to? >If only the optimisation-part of G++ is buggy, then perhaps I could >use a free-ware/gnu-ware C++ to C convertor and use the output of that >to feed into the (hopefully bugfree) GNU C compiler. Does anyone know >of a such a program? This gets asked frequently. It seems the only such beast that ever existed was AT&T's `cfront', which is by now quite obsolete and definitely not free. >Why is G++ so bad? Is it C++'s fault or something? I assume that Gcc >is a lot less buggy since I have compiled some large projects with it. Well, the C part gets pounded on a lot more, especially in Unix-land. Also, C++ is a *much* more complicated language, and a C++ compiler gets proportionally more complicated, harder to maintain, and buggy. I think it's also possible you may have hit a special case. Please continue to report bugs to GNU folk, even if they don't respond. Then we can all enjoy a better compiler. Nate Eldredge eldredge AT ap DOT net