------- Comment #6 from roebel at ircam dot fr 2008-01-28 00:14 ------- Andrew,
while -ffloat-store fixes the problem, this solution is obviously not acceptable. Moreover, here the problem is not that I compare floats using <= the problem is that std::set<double>::insert(double) compares set elements using std::less<double> which in this case just does not work. Now using std::less<double> for a set does not seem not carefull to me, be cause this is the default. So the default is nonsense ? I fixed the problem by means of using std::set<double,dless> with dless being struct dless{ typedef double first_argument_type; typedef double second_argument_type; typedef bool result_type; volatile double d1; volatile double d2; bool operator()(double in1, double in2) { d1 = in1; d2 = in2; return d1 < d2; } }; which proves that the problem is in the std::less operator and not in my code. In fact this even means that std::less<double> and std::greater<double> and all their company is useless because you can never be sure what they are comparing. So many of the functions of the std::library may fail!! Am I wrong, here ? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34992