------- Comment #8 from dberlin at gcc dot gnu dot org  2006-12-19 14:30 -------

> 
> Is it reasonable and prudent to have tests like "if (n == 0)"
> optimised away at the -O2 optimisation level ?
> 
Yes

> We should remember that -O2 is heavily used by lots of
> customers.

And they expect a lot from our optimizers.

> 
> Some customers might argue that the old behaviour was fine at
> -O2 and such a tense optimisation should only be available at
> higher optimisation levels or moved into a special flag that the
> user can set if they want to from the command line.

The problem is that this "old behavior" is simply "luck".  You are simply
*lucky* the optimizer wasn't smart enough to remove the check in all cases.

Now it is.

> 
> There is a clear tradeoff here. If the new behaviour remains,
> I suspect the flag -fwrapv will be a popular flag ;->

We have and will continue to optimize based on what the standard says we can
do, and provide users flags to do otherwise.

You want to do otherwise, so please use the flags.


-- 

dberlin at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30245

Reply via email to