Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testcase failure with optimization -O2 and -O1 in gcc and llvm #213

Closed
Jac1494 opened this issue Jul 25, 2019 · 0 comments
Closed

Testcase failure with optimization -O2 and -O1 in gcc and llvm #213

Jac1494 opened this issue Jul 25, 2019 · 0 comments

Comments

@Jac1494
Copy link
Contributor

Jac1494 commented Jul 25, 2019

Hi,
The below testcase fails when compiled with optimization.
https://github.com/boostorg/fusion/blob/develop/test/functional/invoke.cpp#L391
https://github.com/boostorg/fusion/blob/develop/test/functional/invoke.cpp#L401

like,
$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.

$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)

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.
Like to know your suggestion before going ahead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant