Opened 9 years ago
Closed 9 years ago
#9161 closed Bugs (fixed)
two definitions of future_object_base in v1.53 and 1.54
Reported by: | Owned by: | viboes | |
---|---|---|---|
Milestone: | Boost 1.55.0 | Component: | thread |
Version: | Boost 1.54.0 | Severity: | Problem |
Keywords: | BOOST_THREAD_VERSION | Cc: |
Description
Our testing with icpc on Linux found one strange issue related to “BOOST_THREAD_VERSION”.
When building the boost thread library (libboost_thread.a), we found that “BOOST_THREAD_VERSION” is defined as “2”, but when the test case (i.e set_exception_at_thread_exit_pass.cpp) is built, the “BOOST_THREAD_VERSION” is “4”. So when “-ipo” Is used, icpc gives link errors because two definitions of the same class “struct future_object_base : enable_shared_from_this<future_object_base>” is used.
But Gcc seems working fine with its whole program optimization.
Change History (10)
comment:1 by , 9 years ago
comment:2 by , 9 years ago
Component: | None → thread |
---|---|
Owner: | set to |
comment:3 by , 9 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:4 by , 9 years ago
Resolution: | → wontfix |
---|---|
Status: | assigned → closed |
I have no way to solve this issue.
If you want to use BOOST_THREAD_VERSION 4 I suspect that you will need to build Boost with this define.
follow-up: 6 comment:5 by , 9 years ago
Resolution: | wontfix |
---|---|
Status: | closed → reopened |
As the person who suggested Jennifer file a bug report here I feel I should try and clarify the issue (Jennifer works for Intel: her interest is in testing their compiler against Boost, but of course this uncovers bugs in Boost as well as their compiler).
1) In the headers I see things like:
#if defined BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION typedef shared_ptr<shared_state_base> continuation_ptr_type; #else // This type shouldn't be included, but is included to maintain the same layout. typedef shared_ptr<void> continuation_ptr_type; #endif
So it appears that the intention is that the library should be binary compatible regards of the setting of BOOST_THREAD_VERSION? And yet that's clearly not the case - at least in the presence of IPO. At the very least this needs clearly documenting.
2) There are many tests which explicitly test version 3 or 4 features, but which still try and link against a library built with version 2. Again this won't work in the presence of IPO, and prevents the running of tests with IPO enabled (which is a good thing to test BTW). So IMO the Jamfile is broken - you should really build 3 versions of libboost_thread (for versions 2, 3 and 4) and link against the right one in each test. Clearly that's going to be tedious to fix, but I don't see how the current situation can be correct either (So it might actually be better to fix 1).
Let me know if you need someone to run the tests with Intel C++.
comment:6 by , 9 years ago
Replying to johnmaddock:
As the person who suggested Jennifer file a bug report here I feel I should try and clarify the issue (Jennifer works for Intel: her interest is in testing their compiler against Boost, but of course this uncovers bugs in Boost as well as their compiler).
1) In the headers I see things like:
#if defined BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION typedef shared_ptr<shared_state_base> continuation_ptr_type; #else // This type shouldn't be included, but is included to maintain the same layout. typedef shared_ptr<void> continuation_ptr_type; #endifSo it appears that the intention is that the library should be binary compatible regards of the setting of BOOST_THREAD_VERSION? And yet that's clearly not the case - at least in the presence of IPO. At the very least this needs clearly documenting.
I don't know what IPO is, but yes the intention was to have the same layout.
2) There are many tests which explicitly test version 3 or 4 features, but which still try and link against a library built with version 2. Again this won't work in the presence of IPO, and prevents the running of tests with IPO enabled (which is a good thing to test BTW). So IMO the Jamfile is broken - you should really build 3 versions of libboost_thread (for versions 2, 3 and 4) and link against the right one in each test. Clearly that's going to be tedious to fix, but I don't see how the current situation can be correct either (So it might actually be better to fix 1).
Let me know if you need someone to run the tests with Intel C++.
Could you replace
#if defined BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION typedef shared_ptr<shared_state_base> continuation_ptr_type; #else // This type shouldn't be included, but is included to maintain the same layout. typedef shared_ptr<void> continuation_ptr_type; #endif
by
typedef shared_ptr<shared_state_base> continuation_ptr_type;
to see if just this fix the issue?
comment:10 by , 9 years ago
Milestone: | To Be Determined → Boost 1.55.0 |
---|---|
Resolution: | → fixed |
Status: | reopened → closed |
Committed revision [86202].
Adding more detail:
when “-ipo” Is used, icpc generates incorrect code because two definitions of the same class “struct future_object_base : enable_shared_from_this<future_object_base>” is used. At "-ipo", icpc treats those classes as two different classes. case1: =====
case 2:
struct future_object_base : enable_shared_from_this<future_object_base>