Modify

Opened 6 years ago

Closed 5 years ago

Last modified 8 months 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

Attachments (0)

Change History (10)

comment:1 Changed 5 years ago by viboes

Owner: changed from Anthony Williams to viboes
Status: newassigned

comment:2 Changed 5 years ago by viboes

Status: assignednew

comment:3 Changed 5 years ago by viboes

Status: newassigned

comment:4 Changed 5 years ago by viboes

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 Changed 5 years ago by viboes

Milestone: To Be Determined
Resolution: wontfix
Status: assignedclosed

comment:6 Changed 5 years ago by barnabe.faliu@…

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 Changed 5 years ago by viboes

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 Changed 5 years ago by viboes

Milestone: Boost 1.54.0

comment:9 Changed 5 years ago by viboes

Resolution: fixed
Status: reopenedclosed

Committed revision [83525].

comment:10 Changed 8 months ago by alexandre.nunes@…

Boost 1.63.0 + gcc 6.3.0 still have strict aliasing issues in win32/shared_mutex.hpp. See #12733 for a patch.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain viboes.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.