Opened 11 years ago

Closed 10 years ago

Last modified 6 years ago

#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: flavio.perri@… 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 viboes, 11 years ago

Owner: changed from Anthony Williams to viboes
Status: newassigned

comment:2 by viboes, 11 years ago

Status: assignednew

comment:3 by viboes, 10 years ago

Status: newassigned

comment:4 by viboes, 10 years ago

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.

comment:5 by viboes, 10 years ago

Milestone: To Be Determined
Resolution: wontfix
Status: assignedclosed

comment:6 by barnabe.faliu@…, 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 viboes, 10 years ago

Resolution: wontfix
Status: closedreopened

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 viboes, 10 years ago

Milestone: Boost 1.54.0

comment:9 by viboes, 10 years ago

Resolution: fixed
Status: reopenedclosed

Committed revision [83525].

comment:10 by alexandre.nunes@…, 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.

Note: See TracTickets for help on using tickets.