Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 May 2007 10:53:09 +0200
From:      Stefan Ehmann <shoesoft@gmx.net>
To:        freebsd-current@freebsd.org
Cc:        Kris Kennaway <kris@obsecurity.org>, Steve Kargl <sgk@troutmask.apl.washington.edu>, Ed Schouten <ed@fxq.nl>
Subject:   Re: HEADS-UP: gcc-4.2 import appears to miscompile libm.
Message-ID:  <200705271053.10725.shoesoft@gmx.net>
In-Reply-To: <20070526233116.GA56054@troutmask.apl.washington.edu>
References:  <20070526193128.GB54875@troutmask.apl.washington.edu> <20070526190023.C98508@volatile.chemikals.org> <20070526233116.GA56054@troutmask.apl.washington.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
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.

[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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200705271053.10725.shoesoft>