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]

potental fp const fold problem


Gcc will optimize 

  static const double zero = 0.0;
  double foo() { return zero/zero; }

to 

  double foo() { return NAN; }

The problem with this is that the IEEE invalid operation exception
summary bit does not get set as it would if the division had been
performed.

While browsing fold-const.c though, I found

          /* In IEEE floating point, x*1 is not equivalent to x for snans.
             However, ANSI says we can drop signals,
             so we can do this anyway.  */

So does this mean that the transformation was legal?  If so the
bug is in glibc (or its test suite), so it would be nice if someone
could clarify this.


r~


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