Opened 10 years ago

Last modified 10 years ago

#7765 closed Bugs

Warnings from shared_mutex.hpp when including thread.hpp — at Version 3

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 (3)

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
Note: See TracTickets for help on using tickets.