From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5354 invoked by alias); 4 May 2006 10:47:34 -0000 Received: (qmail 5336 invoked by uid 48); 4 May 2006 10:47:25 -0000 Date: Thu, 04 May 2006 10:47:00 -0000 Subject: [Bug other/27417] New: wrong code or aliasing violation with missed diagnostic? X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "pluto at agmk dot net" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-05/txt/msg00350.txt.bz2 List-Id: inline float quickBinaryToFloat( unsigned const& in ) { return reinterpret_cast< float const& >( in ) ; } float foo( unsigned x ) { unsigned y = ( x * 2 ) + 1; return quickBinaryToFloat( y ); } [ wrong-code generated ] $ i486-gnu-linux-g++ bin2float.cpp -Wall -O2 -c -fomit-frame-pointer -m32 00000000 : 0: 83 ec 10 sub $0x10,%esp 3: d9 44 24 0c flds 0xc(%esp) 7: 83 c4 10 add $0x10,%esp a: c3 ret [ correct code generated ] $ i486-gnu-linux-g++ bin2float.cpp -Wall -O2 -c -fomit-frame-pointer -m32 \ -fno-strict-aliasing 00000000 : 0: 83 ec 10 sub $0x10,%esp 3: 8b 44 24 14 mov 0x14(%esp),%eax 7: 8d 44 00 01 lea 0x1(%eax,%eax,1),%eax b: 89 44 24 0c mov %eax,0xc(%esp) f: d9 44 24 0c flds 0xc(%esp) 13: 83 c4 10 add $0x10,%esp 16: c3 ret -- Summary: wrong code or aliasing violation with missed diagnostic? Product: gcc Version: 4.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: other AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pluto at agmk dot net GCC build triplet: i486-linux GCC host triplet: i486-linux GCC target triplet: i486-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27417