#6652 closed Bugs (fixed)
Boost.Thread shared_mutex.hpp:50:99: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
Reported by: | Owned by: | viboes | |
---|---|---|---|
Milestone: | Boost 1.54.0 | Component: | thread |
Version: | Boost 1.49.0 | Severity: | Problem |
Keywords: | thread mutex warning | Cc: |
Description
I'm using the Boost.Thread library since 1.47. When including <boost/thread/thread.hpp> my compiler (mingw 4.6) always writes a number of annoying warnings like this:
../boost/thread/win32/shared_mutex.hpp:50:99: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
another warning is: /boost/thread/win32/shared_mutex.hpp:95:33: warning: missing initializer for member 'boost::shared_mutex::state_data::shared_waiting' [-Wmissing-field-initializers]
Same warnings in 1.47, 1.48 and 1.49 using the same compiler.
The gcc options used: -pedantic -ansi -std=gnu++0x -Wextra -fpermissive
Change History (10)
comment:1 by , 11 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 11 years ago
Status: | assigned → new |
---|
comment:3 by , 10 years ago
Status: | new → assigned |
---|
comment:4 by , 10 years ago
comment:5 by , 10 years ago
Milestone: | To Be Determined |
---|---|
Resolution: | → wontfix |
Status: | assigned → closed |
comment:6 by , 10 years ago
I have the same problems using boost 1.52.0, even if I define "BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN". Any solutions ?
comment:7 by , 10 years ago
Resolution: | wontfix |
---|---|
Status: | closed → reopened |
Reopened as BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN will not be defined by default and as #7906 states there is a lost in performances when this define is defined.
comment:8 by , 10 years ago
Milestone: | → Boost 1.54.0 |
---|
comment:9 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Committed revision [83525].
comment:10 by , 6 years ago
Boost 1.63.0 + gcc 6.3.0 still have strict aliasing issues in win32/shared_mutex.hpp. See #12733 for a patch.
Boost 1.50 avoids these warnings if you define BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN or BOOST_THREAD_VERSION=3.
The default value for BOOST_THREAD_VERSION is 2 on 1.50, but will be 3 in a near release, so maybe you can already switch.
I will not try to fix these warning in the legacy code. Let me know if we can close this tickets as wontfix.