Opened 12 years ago
Closed 9 years ago
#4759 closed Bugs (invalid)
shared_ptr to bool cast with Intel C++ Composer XE 2011
Reported by: | Owned by: | Peter Dimov | |
---|---|---|---|
Milestone: | To Be Determined | Component: | smart_ptr |
Version: | Boost 1.49.0 | Severity: | Problem |
Keywords: | shared_ptr Intel bool cast | Cc: |
Description
shared_ptr-to-bool cast sometimes doesn't work on Intel C++ Compiler 11.1.
Suggested patch:
--- boost/smart_ptr/detail/operator_bool.hpp Пн мар 2 10:45:22 2009 +++ boost/smart_ptr/detail/operator_bool.hpp Чт сен 2 23:30:11 2010 @@ -6,7 +6,7 @@ // See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt -#if ( defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, < 0x570) ) || defined(__CINT__) +#if ( defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, < 0x570) ) || defined(__CINT__) || defined (BOOST_INTEL) operator bool () const {
As test asio-samples project may be used. Watch at svn repository for the echo_server project: /src/ma/echo/server/session_manager.cpp:151. The "while" cycle doesn't work right (cycle works when shared ptr "active_session" points to nothing) without the suggested patch.
Attachments (3)
Change History (13)
by , 12 years ago
Attachment: | shared_ptr_operator_bool.patch added |
---|
comment:2 by , 12 years ago
Replying to pdimov:
Can you please attach a simple test case?
I tried to provide a simple test case but it's not so simple (simple tests passes well).
Even in echo_server at some places Intel C++ Compiler works well (but failes in many places too).
The echo_server project is rather simple - it uses only Boost C++ Libraries and "standard" MS Windows headers. So it is rather simple to build it (from MS Visual Studio with integrated Intel C++ Compiler - use /build/intel11/asio-samples.sln).
Make test without patch and within it - and You'll see the difference.
follow-up: 4 comment:3 by , 12 years ago
It seems (working with Boost 1.46 with
#undef BOOST_NO_RVALUE_REFERENCES
added to boost/config/compiler/intel.hpp) that compiler option (added from Commind Line memo in project settings) /vmg is the source of problem.
I will update asio-samples project in a week to provide public access to Intel-Compiler-12-based projects.
by , 12 years ago
Attachment: | intel_rvalue_ref_on.patch added |
---|
Turn on rvalue referense support in Intel C++ Compiler 12
comment:4 by , 12 years ago
Replying to abrarov@…:
It seems (working with Boost 1.46 with
#undef BOOST_NO_RVALUE_REFERENCESadded to boost/config/compiler/intel.hpp) that compiler option (added from Commind Line memo in project settings) /vmg is the source of problem.
I will update asio-samples project in a week to provide public access to Intel-Compiler-12-based projects.
Done. Project "echo_server" works fine with ICC 12.x and suggested patch and crashes because of shared_ptr-to-bool cast (src/ma/echo/server/session_manager.cpp: line 316) without patch.
comment:5 by , 11 years ago
Test environment:
- Windows 7 Ultimate x86 Russian.
- MS Visual Studio 2010 SP1.
- Intel C++ Composer XE 2011 update 7.
See cpp_test.zip attachment for test showing problem in debug mode only. Note /vmg compiler option (not needed for MSVC 10.0, but required for Intel C++ Composer).
comment:7 by , 11 years ago
Summary: | shared_ptr to bool cast with Intel C++ Compiler 11.1 → shared_ptr to bool cast with Intel C++ Composer XE 2011 |
---|---|
Version: | Boost 1.44.0 → Boost 1.49.0 |
follow-up: 9 comment:8 by , 10 years ago
Related bug #8152.
I am seeing the same issue with MSVC-9 and MSVC-10 compilers. The shared_ptr to bool conversion is causing write access violations when using the /vmg option. This looks like a compiler bug to me, as I reproduced it with the standard safe bool idiom implementation on a simple class.
comment:9 by , 10 years ago
My problem with the MSVC compilers turned out to be a binary incompatibility issue. I was using the pointers_to_members pragma but I did not apply it carefully enough (which looks rather difficult). I ended up with multiple member references using different internal representations. I violated the one definition rule.
This also may be the cause of this problem too. Maybe the /vmg option is not being consistently applied for the same smart pointer types?
comment:10 by , 9 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Closing as too old and possibly no longer relevant.
Suggested patch