On the trunk (and supposedly on 4.5 too) fold checking bootstrap fails e.g. while building dyncast.cc in libsupc++ (and some ada compilations too). I've debugged the dyncast.cc failure, the problem is that fold_build3_loc on loc, COND_EXPR, type, EQ_EXPR, 1, 0 modifies the EQ_EXPR by changing its locus. This is because /* Convert A ? 1 : 0 to simply A. */ folding calls pedantic_non_lvalue_loc, and that one if !pedantic_lvalues modifies the passed expr's locus. I'd say most of the protected_set_expr_location calls in fold-const.c are suspicios. Either it is in places where fold-const first calls build[1-5] followed by protected_set_expr_location, IMHO in these cases we should just apply Tobias' build[1-5]_loc patch and use those routines instead, and the rest either should be dropped altogether (fold_convert_loc also ignores locus if the type is already right, etc.), or, if the locus is really essentialy, should do nothing if the locus is equal and if not, do a copy_node and set the locus on the copy and return it.
-- Summary: [4.5/4.6 Regression] --enable-checking=fold bootstrap failures Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: bootstrap AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jakub at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45700