This is the mail archive of the gcc-bugs@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]

[Bug rtl-optimization/323] optimized code gives strange floating point results



------- Comment #132 from ich at az2000 dot de  2009-07-22 20:54 -------
So that means that this C++ example could crash under certain circumstances
(depending on how far the compiler is optimising here)?

#include <set>
#define third             ((double)atoi("1")/atoi("3"))
int main() {
  std::set<double> m;
  m.insert(third);
  m.insert(third);
  return (m.find(third) != m.end()) ? 0 : 1;
}


Because this example only works if it is guaranteed that !(third < third &&
third > third), otherwise it would abort. 


-- 


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


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