http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54692
--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-09-24 15:04:06 UTC --- (In reply to comment #8) > (In reply to comment #6) > > Guess > > *) CFLAGS=`echo $CFLAGS | sed "s/-O[[s0-9]]* *//" ` > > CXXFLAGS=`echo $CXXFLAGS | sed "s/-O[[s0-9]]* *//" ` ;; > > needs to be now > > -O[[s0-9gf]] instead (also for -Ofast). > > That said, I don't see how it is related to using STAGE1_CFLAGS (note > > missing > > XX). > > I wonder why we do the above at all? I suppose that's for removing > a configure default, but the toplevel passes STAGE1_CFLAGS as CFLAGS to > gcc configure (that's why we need to re-specify CFLAGS on the make > command-line?!). The intent of this is to make sure that the toplevel Makefile has whatever fancy CXXFLAGS/CFLAGS is needed for bootstrapping, and gcc/Makefile has corresponding CXXFLAGS/CFLAGS without -O2 or similar in it. Thus, if in --disable-bootstrap (or cross) gcc you do make in toplevel, you are building an optimized compiler, while cd gcc; make after you tweak stuff here and there will default to no optimization and thus hopefully better debugging experience. If/when -Og is better than -O0 for debug experience surely we can use there -Og instead. >From toplevel make just passes down CXXFLAGS/CFLAGS, so the values stored in gcc/Makefile are ignored.