linux-mips
[Top] [All Lists]

Re: gcc crash

To: Keith Owens <kaos@melbourne.sgi.com>
Subject: Re: gcc crash
From: Ralf Baechle <ralf@oss.sgi.com>
Date: Fri, 28 Sep 2001 19:05:38 +0200
Cc: Kjeld Borch Egevang <kjelde@mips.com>, linux-mips mailing list <linux-mips@oss.sgi.com>
In-reply-to: <19900.1001680672@ocs3.intra.ocs.com.au>; from kaos@melbourne.sgi.com on Fri, Sep 28, 2001 at 10:37:52PM +1000
References: <Pine.LNX.4.30.0109271657250.1742-100000@coplin19.mips.com> <19900.1001680672@ocs3.intra.ocs.com.au>
Sender: owner-linux-mips@oss.sgi.com
User-agent: Mutt/1.2.5i
On Fri, Sep 28, 2001 at 10:37:52PM +1000, Keith Owens wrote:

> On Thu, 27 Sep 2001 16:59:47 +0200 (CEST), 
> Kjeld Borch Egevang <kjelde@mips.com> wrote:
> >When I compile the following function with "gcc -O2" the compiler crashes.
> >static float sp_f2l(float x)
> >{
> >    long l, *xl;
> >    float y;
> >
> >    xl = (void *)&y;
> >    l = x;
> >    *xl = l;
> >    return y;
> >}
> 
> You are breaking the C rules for data accesses.  Compile with
> -fno-strict-aliasing if you want to break the rules.  Or, and this is
> much better, use a union of long and float to "convert" one
> representation to another.

Yes said the compiler is crashing so that's definately a gcc bug.  Aside
of course of the code itself being buggy also.

  Ralf

<Prev in Thread] Current Thread [Next in Thread>