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]
Other format: [Raw text]

Re: Optimizing GCC


Paolo Carlini wrote:
> in these days, when many GCC developers are striving to improve the
> compile-time performance of the compiler, I read with amazement this
> short article:
>
>     http://www.linuxgazette.com/issue88/piszcz.html
>
> Honestly, I didn't try to reproduce the results, but if confirmed seems
> really interesting!


Questions:

1. Can you expect a custom-optimized gcc binary and a default-optimized 
gcc binary to produce the same output, if fed the same source and the 
same options?

I guess the answer is: "depends on how gcc was optimized", so the 
sub-question is:
What, if any, other than default options (used to compile gcc) will not 
change the output if compared with the output of a default-optimized 
gcc binary?

In particular, is -march=<something> safe?


2. If a default-optimized gcc binary and a custom-optimized gcc binary do
produce different output when fed the same source and options, must I
assume that the output from my custom-optimized gcc binary is broken?


3. Will the gcc testsuite or stage2/stage3 comparison reliably catch a 
broken compiler?  (i.e. broken output)?


4. What questions did I forget to ask on this subject, and what are the 
answers? :-)


http://gcc.gnu.org/install/build.html says:

"If you wish to use non-default GCC flags when compiling the stage2 and stage3
compilers, set BOOT_CFLAGS on the command line when doing make bootstrap. 
Non-default optimization flags are less well tested here than the default 
of -g -O2, but should still work."

and

"If the comparison of stage2 and stage3 fails, this normally indicates 
that the stage2 compiler has compiled GCC incorrectly, and is therefore 
a potentially serious bug which you should investigate and report. 
(On a few systems, meaningful comparison of object files is impossible; 
they always appear "different". If you encounter this problem, you will 
need to disable comparison in the Makefile.) "


Dag B


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