From owner-freebsd-current@FreeBSD.ORG Sun May 27 19:28:26 2007 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AC8D016A421 for ; Sun, 27 May 2007 19:28:26 +0000 (UTC) (envelope-from kris@obsecurity.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 76FEB13C465 for ; Sun, 27 May 2007 19:28:26 +0000 (UTC) (envelope-from kris@obsecurity.org) Received: from obsecurity.dyndns.org (elvis.mu.org [192.203.228.196]) by elvis.mu.org (Postfix) with ESMTP id 7E06D1A3C19; Sun, 27 May 2007 12:29:32 -0700 (PDT) Received: from rot13.obsecurity.org (rot13.obsecurity.org [192.168.1.5]) by obsecurity.dyndns.org (Postfix) with ESMTP id A4336512C2; Sun, 27 May 2007 15:28:25 -0400 (EDT) Received: by rot13.obsecurity.org (Postfix, from userid 1001) id 49C00C17C; Sun, 27 May 2007 15:28:25 -0400 (EDT) Date: Sun, 27 May 2007 15:28:25 -0400 From: Kris Kennaway To: Steve Kargl Message-ID: <20070527192825.GA79242@rot13.obsecurity.org> References: <20070526193128.GB54875@troutmask.apl.washington.edu> <20070526190023.C98508@volatile.chemikals.org> <20070526233116.GA56054@troutmask.apl.washington.edu> <200705271053.10725.shoesoft@gmx.net> <20070527151840.GA73374@troutmask.apl.washington.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070527151840.GA73374@troutmask.apl.washington.edu> User-Agent: Mutt/1.4.2.2i Cc: freebsd-current@freebsd.org, Ed Schouten , Stefan Ehmann , Kris Kennaway Subject: Re: HEADS-UP: gcc-4.2 import appears to miscompile libm. X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 May 2007 19:28:26 -0000 On Sun, May 27, 2007 at 08:18:40AM -0700, Steve Kargl wrote: > On Sun, May 27, 2007 at 10:53:09AM +0200, Stefan Ehmann wrote: > > On Sunday 27 May 2007 01:31:16 Steve Kargl wrote: > > > On Sat, May 26, 2007 at 07:09:16PM -0400, Wes Morgan wrote: > > > > Working from -O towards -O2 based on the info pages, I can "reproduce" > > > > the problem with "-O -fstrict-aliasing -fgcse"... However, -O2 with > > > > -fno-strict-aliasing by itself seems to work around the issue. At first > > > > glance it looks like a possible interaction between several > > > > optimizations. > > > > > > Ths patch fixes the problem. > > > > > > --- s_frexpf.c.orig Sat May 26 16:26:50 2007 > > > +++ s_frexpf.c Sat May 26 16:28:03 2007 > > > @@ -39,6 +39,9 @@ > > > } > > > *eptr += (ix>>23)-126; > > > hx = (hx&0x807fffff)|0x3f000000; > > > +#if 0 > > > *(int*)&x = hx; > > > +#endif > > > + SET_FLOAT_WORD(x,hx); > > > return x; > > > } > > > > -fno-strict-aliasing is used by default for me (i386). Also, if you use -Wall > > the compiler outputs a warning. > > You apparently don't have CFLAGS set in /etc/make.conf. > > > [root@something /usr/src/lib/msun/src]# cc -O2 -Wall -pipe -c s_frexpf.c > > s_frexpf.c: In function 'frexpf': > > s_frexpf.c:42: warning: dereferencing type-punned pointer will break > > strict-aliasing rules > > Yes, I know. > > OTOH, the above patch actually fixes the problem, and libm can then > be compiled without -fno-strict-aliasing. OK, so just to confirm, it's not a miscompilation as originally suggested, but a code bug? Kris