bug in boost or in gcc-5.2.0 ?
I have a strange problem with mingw-w64, gcc-5.2.0 in 32bits on windows in release. The following code leads to a crash (it is working in 64 bits and in debug). The adress of return in the stack seems to be broken. I was not able to reduce it more than this, and in particular I am not able to remove BOOST_CHECK_CLOSE (using BOOST_CHECK_EQUAL works). This can be either a bug in gcc (false code generation) or something else. How can I investigate ? #define BOOST_TEST_MODULE MyTest #include <boost/test/unit_test.hpp> #include <iostream> struct P { P(double x_, double y_): x(x_), y(y_) {} double x; double y; }; struct Seg { Seg(const P & o_, const P & e_): o(o_), e(e_) {} P o; P e; }; void f() { auto Check = [](const Seg & s1, const Seg & s2, bool expected_common_cut, double expected_length) { std::cerr << expected_length << std::endl; BOOST_CHECK_CLOSE(1e-3, 1e-4, .1); }; Check(Seg(P(0, 0), P(100, 0)), Seg(P(0, 0), P(100, 0)), false, 0.0); Check(Seg(P(0, 0), P(100, 0)), Seg(P(100, 0), P(0, 0)), true, 100.0); std::cerr << "STILL LEAVING !" << std::endl; } void g() { std::cerr << "BEFORE CRASH" << std::endl; f(); std::cerr << "NEVER PRINTED" << std::endl; } BOOST_AUTO_TEST_CASE( my_test ) { g(); }
renaud lepere <lepere.renaud <at> yahoo.com> writes:
I have a strange problem with mingw-w64, gcc-5.2.0 in 32bits on windows in release. The following code leads to a crash (it is working in 64 bits and in debug). The adress of return in the stack seems to be broken. I was not able to reduce it more than this, and in particular I am not able to remove BOOST_CHECK_CLOSE (using BOOST_CHECK_EQUAL works).
I do not have access to this setup. Can you try 1.59's BOOST_TEST version for floating points comparisons? Gennadiy
With BOOST_1_59 vs 1_57, the simple test case works. However I still have unexpected failure latter in my code (crash), but I have difficulties to reduce to a simple test case (not yet succeed). However, if I replace the lambda Check by a function in my code base then it works perfeclty well. If I remove calls to BOOST_CHECK in the lambda it works also. Is it bad to use a lambda together with BOOST_CHECK ? Le 28/09/2015 18:32, Gennadiy Rozental a écrit :
renaud lepere <lepere.renaud <at> yahoo.com> writes:
I have a strange problem with mingw-w64, gcc-5.2.0 in 32bits on windows in release. The following code leads to a crash (it is working in 64 bits and in debug). The adress of return in the stack seems to be broken. I was not able to reduce it more than this, and in particular I am not able to remove BOOST_CHECK_CLOSE (using BOOST_CHECK_EQUAL works).
I do not have access to this setup. Can you try 1.59's BOOST_TEST version for floating points comparisons?
Gennadiy
participants (2)
-
Gennadiy Rozental
-
renaud lepere