Modify

Ticket #4053 (closed Bugs: duplicate)

Opened 4 years ago

Last modified 3 years ago

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

Reported by: Joe Steeve <js@…> Owned by: fcacciola
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

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

Change History

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

Sample code to reproduce issue

comment:1 Changed 4 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 4 years ago by Joe Steeve <js@…>

  • Cc js@… added

comment:3 Changed 4 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 4 years ago by steven_watanabe

  • Owner changed from fmhess to fcacciola
  • Component changed from signals2 to optional

comment:5 Changed 4 years ago by anonymous

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

comment:6 Changed 3 years ago by andysem

  • Status changed from new to closed
  • Resolution set to duplicate

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).

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


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

 
Note: See TracTickets for help on using tickets.