Opened 10 years ago

Closed 10 years ago

#7765 closed Bugs (duplicate)

Warnings from shared_mutex.hpp when including thread.hpp

Reported by: barnabe.faliu@… Owned by: viboes
Milestone: To Be Determined Component: thread
Version: Boost 1.52.0 Severity: Problem
Keywords: Cc:

Description (last modified by viboes)

Just by including <boost/thread/thread.hpp>, when I compile my program I get thoose warnings:

'''C:\Boost\boost_1_52_0/boost/thread/win32/shared_mutex.hpp: In instantiation of 'T boost::shared_mutex::interlocked_compare_exchange(T*, T, T) [with T = boost::shared_mutex::state_data]':
C:\Boost\boost_1_52_0/boost/thread/win32/shared_mutex.hpp:124:103:   required from here
C:\Boost\boost_1_52_0/boost/thread/win32/shared_mutex.hpp:52:99: warning: dereferencing type-punned pointer will break strict-aliasing rules
C:\Boost\boost_1_52_0/boost/thread/win32/shared_mutex.hpp:52:99: warning: dereferencing type-punned pointer will break strict-aliasing rules
C:\Boost\boost_1_52_0/boost/thread/win32/shared_mutex.hpp:53:52: warning: dereferencing type-punned pointer will break strict-aliasing rules
C:\Boost\boost_1_52_0/boost/thread/win32/shared_mutex.hpp:53:52: warning: dereferencing type-punned pointer will break strict-aliasing rules'''

Help please !

Change History (8)

comment:1 by mwilamowski[|]wne.uw.edu.pl, 10 years ago

Hi, I have the same problem. Windows 7 64-bit, MinGW (g++ 4.7.0). Boost 1.52.

I'm writing here because i noticed that this error (warnings) do not appear with O0 and O1 flags but they do with O2 and O3. Maybe that helps.

Whats more the program compiles and works without any problems (though my application is not very complex).

in reply to:  1 comment:2 by anonymous, 10 years ago

Just want to add that i just tested it with g++ 4.7.2 and with and without -std=gnu++11 flag. Problem appears consistently.

comment:3 by viboes, 10 years ago

Component: Nonethread
Description: modified (diff)
Milestone: Boost 1.52.0To Be Determined
Owner: set to viboes
Status: newassigned

comment:4 by viboes, 10 years ago

Please, could you tell me if the warnings appear when you define BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN?

comment:5 by viboes, 10 years ago

Resolution: duplicate
Status: assignedclosed

Duplicated from #7817 as it contains more warnings.

comment:6 by anonymous, 10 years ago

It does appear even if i define BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN !!

comment:7 by viboes, 10 years ago

Resolution: duplicate
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

Resolution: duplicate
Status: reopenedclosed
Note: See TracTickets for help on using tickets.