[BOOST] Boost fusion testcase fails with llvm and gcc when optimization enabled

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[BOOST] Boost fusion testcase fails with llvm and gcc when optimization enabled

Boost - Dev mailing list
Hi Devs,
consider below boost testcase,

boost_1_70_0/libs/fusion/test/functional/invoke.cpp

when compiles with optimization enabled,

$g++ -O2 -I./boost_1_70_0 boost_1_70_0/libs/fusion/test/functional/invoke.cpp
$./a.out

./boost_1_70_0/libs/fusion/test/functional/invoke.cpp(391): test
'that.data == fusion::invoke(& members::data,
fusion::join(sv_obj_c_ctx,seq))' failed in function 'void
test_sequence_n(Sequence&, mpl_::int_<0>) [with Sequence =
boost::fusion::vector<>]'

./boost_1_70_0/libs/fusion/test/functional/invoke.cpp(401): test
'that.data == fusion::invoke(& members::data,
fusion::join(sv_obj_c_d_ctx,seq))' failed in function 'void
test_sequence_n(Sequence&, mpl_::int_<0>) [with Sequence =
boost::fusion::vector<>]'

./boost_1_70_0/libs/fusion/test/functional/invoke.cpp(391): test
'that.data == fusion::invoke(& members::data,
fusion::join(sv_obj_c_ctx,seq))' failed in function 'void
test_sequence_n(Sequence&, mpl_::int_<0>) [with Sequence =
boost::fusion::list<>]'

./boost_1_70_0/libs/fusion/test/functional/invoke.cpp(401): test
'that.data == fusion::invoke(& members::data,
fusion::join(sv_obj_c_d_ctx,seq))' failed in function 'void
test_sequence_n(Sequence&, mpl_::int_<0>) [with Sequence =
boost::fusion::list<>]'

4 errors detected.

And When compiled without any optimization

$g++ -O0 -I./boost_1_70_0 boost_1_70_0/libs/fusion/test/functional/invoke.cpp
$./a.out
No errors detected.

$g++ --version
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-9.1.0/configure --  --enable-languages=c,c++
--disable-libquadmath --disable-libquadmath-support --disable-werror
--disable-bootstrap --enable-gold
Thread model: posix
gcc version 9.1.0 (GCC)

Here we demonstrated the test case with g++ but same can be seen with clang++.

When analyzed further we have seen that
this is
[ boost_1_70_0/boost/fusion/functional/invocation/invoke.hpp:139 ]
trying to return local address, which is undefined behavior.
And that lead to above test-case failure.

So either we have to modify test-case to pass as reference or disable
it.But before going ahead like to know your thought/suggestions?

Thanks,
Jaydeep

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost