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: [RFC] fold Reorganization Plan


On Wed, Feb 16, 2005 at 08:01:13AM +0900, Neil Booth wrote:
> Mark Mitchell wrote:-
> 
> > However, while that may be necessary for Java, it's not necessary for 
> > C++.  In C++, fold should only be called for "integral constant 
> > expressions", which, by definition, are made up of simple operations on 
> > integers.  (It's a little more complicated than that, but all the 
> > operands collapse to integers immediately.)  So, all we really need for 
> > C++ is the ability to convert floating-point constants to integer 
> > constants, and the ability to do basic arithmetic on integer constants. 
> 
> I think it's desirable for front-ends to be able to fold floating
> point constant expressions too, no?  It can be handy for diagnostics
> such as detecting overflow or unreachable code based on conditionals
> whose expression is a floating one, albeit constant.

The problem is that the user can independently set the IEEE rounding mode.
This means that you can only fold floating point constants in cases where
the generated result is exact; you cannot fold 1./3. for example.

Also, you should not assume that the user wants the kinds of diagnostics
you describe; they might *want* the Infinity or NaN they generated.


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