fold casted const variables

Joseph S. Myers jsm28@cam.ac.uk
Sun Feb 16 19:31:00 GMT 2003


On Sun, 16 Feb 2003, Jan Hubicka wrote:

> And get same set of warnings from -O2 compilation before and after my
> patch, so I guess it is not making things worse.

In that case it's probably OK - send the full patch that includes those
additions (to both testcases, and with dg-bogus xfail on whichever new
tests generate warnings) and your testcase for this optimization as a
patch to add the testcase wherever you intend to put it in the testsuite.

But we shouldn't be doing these optimizations at the same time as semantic
analysis anyway; we should first build trees that represent the source
code literally (with only constant expressions folded), doing the semantic
analysis at that time, and then run optimizations (including most of
fold()) over the trees for full expressions (expression statements,
initializers, ...).  This would also allow getting rid of 
decl_constant_value_for_broken_optimization and the various cases where 
-pedantic impedes such optimizations.

-- 
Joseph S. Myers
jsm28@cam.ac.uk



More information about the Gcc-patches mailing list