I have a problem in the following code. It crashed in 32bits in release
only and works otherwise (64bits release), it seems that the stack
return adress is corrupted.
I did not succed to remove the dependency to boost/utf since it does not
crash if BOOST_CHECK_CLOSE line is removed.
Also note, that if I replace the lambda with a normal function it works.
The same code was working with gcc-4.8-x but I upgraded to 5.2.0 and I
have this problem. The compiler is generating bad code ?
What can I do ?
#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,
bool dummy, 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)), false, 0.0);
Check(Seg(P(0, 0), P(100, 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();
}
Extract from gcc -v
Target: i686-w64-mingw32
Thread model: posix
gcc version 5.2.0 (i686-posix-sjlj-rev0, Built by MinGW-W64 project)
------------------------------------------------------------------------------
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public