Modify

Opened 8 years ago

Closed 7 years ago

#4053 closed Bugs (duplicate)

signals2 build failure with "error: dereferencing pointer '<anonymous>' does break strict-aliasing..."

Reported by: Joe Steeve <js@…> Owned by: Fernando Cacciola
Milestone: Boost 1.43.0 Component: optional
Version: Boost 1.42.0 Severity: Problem
Keywords: Cc: js@…

Description

An application using signals2 (attached sample code), fails to build on g++ (version 4.4.2-9, Debian squeeze) with the -O2 flag. It builds fine under -O0. The build fails with:

joe@lark:~/sandbox/test$ g++ -o boost-sig boost-sig.cxx -I/opt/hdb/include -Wall -Werror -O2
cc1plus: warnings being treated as errors
/opt/hdb/include/boost/optional/optional.hpp: In function ‘int main()’:
/opt/hdb/include/boost/optional/optional.hpp:315: error: dereferencing pointer ‘<anonymous>’ does break strict-aliasing rules
/opt/hdb/include/boost/optional/optional.hpp:422: note: initialized from here
/opt/hdb/include/boost/optional/optional.hpp:262: error: dereferencing pointer ‘<anonymous>’ does break strict-aliasing rules
/opt/hdb/include/boost/optional/optional.hpp:262: note: initialized from here
/opt/hdb/include/boost/optional/optional.hpp:268: error: dereferencing pointer ‘<anonymous>’ does break strict-aliasing rules
/opt/hdb/include/boost/optional/optional.hpp:268: note: initialized from here

Attachments (1)

boost-sig.cxx (287 bytes) - added by Joe Steeve <js@…> 8 years ago.
Sample code to reproduce issue

Download all attachments as: .zip

Change History (7)

Changed 8 years ago by Joe Steeve <js@…>

Attachment: boost-sig.cxx added

Sample code to reproduce issue

comment:1 Changed 8 years ago by Joe Steeve <js@…>

I think this is not boost's problem. This should be reported to the gcc guys. I'll go there.

comment:2 Changed 8 years ago by Joe Steeve <js@…>

Cc: js@… added

comment:3 Changed 8 years ago by Joe Steeve <js@…>

Ok, on some more digging:

http://lists.boost.org/Archives/boost/2009/12/160236.php http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21920

I'm just gonna disable -O2 in my build system for the time being.

comment:4 Changed 8 years ago by Steven Watanabe

Component: signals2optional
Owner: changed from Frank Mori Hess to Fernando Cacciola

comment:5 Changed 7 years ago by anonymous

Works correct with g++ 4.4.3 (Ubuntu Lucid Lynx).

comment:6 Changed 7 years ago by Andrey Semashev

Resolution: duplicate
Status: newclosed

There is ticket #3774 about strict aliasing warnings, I'm marking this ticket as duplicate.

As a side note, the error is actually a warning, which is probably elevated to error due to a compiler switch. Either remove that switch or disable strict aliasing optimization (-fno-strict-aliasing).

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Fernando Cacciola.
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.