All of lore.kernel.org
 help / color / mirror / Atom feed
* gcc crash
@ 2001-09-27 14:59 Kjeld Borch Egevang
  2001-09-28 12:37 ` Keith Owens
  2001-09-29  8:35 ` H . J . Lu
  0 siblings, 2 replies; 4+ messages in thread
From: Kjeld Borch Egevang @ 2001-09-27 14:59 UTC (permalink / raw)
  To: linux-mips mailing list

When I compile the following function with "gcc -O2" the compiler crashes.
Is this a known problem?

static float sp_f2l(float x)
{
    long l, *xl;
    float y;

    xl = (void *)&y;
    l = x;
    *xl = l;
    return y;
}

I use gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-97.2)

/Kjeld

-- 
_    _ ____  ___                       Mailto:kjelde@mips.com
|\  /|||___)(___    MIPS Denmark       Direct: +45 44 86 55 85
| \/ |||    ____)   Lautrupvang 4 B    Switch: +45 44 86 55 55
  TECHNOLOGIES      DK-2750 Ballerup   Fax...: +45 44 86 55 56
                    Denmark            http://www.mips.com/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: gcc crash
  2001-09-27 14:59 gcc crash Kjeld Borch Egevang
@ 2001-09-28 12:37 ` Keith Owens
  2001-09-28 17:05   ` Ralf Baechle
  2001-09-29  8:35 ` H . J . Lu
  1 sibling, 1 reply; 4+ messages in thread
From: Keith Owens @ 2001-09-28 12:37 UTC (permalink / raw)
  To: Kjeld Borch Egevang; +Cc: linux-mips mailing list

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: gcc crash
  2001-09-28 12:37 ` Keith Owens
@ 2001-09-28 17:05   ` Ralf Baechle
  0 siblings, 0 replies; 4+ messages in thread
From: Ralf Baechle @ 2001-09-28 17:05 UTC (permalink / raw)
  To: Keith Owens; +Cc: Kjeld Borch Egevang, linux-mips mailing list

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: gcc crash
  2001-09-27 14:59 gcc crash Kjeld Borch Egevang
  2001-09-28 12:37 ` Keith Owens
@ 2001-09-29  8:35 ` H . J . Lu
  1 sibling, 0 replies; 4+ messages in thread
From: H . J . Lu @ 2001-09-29  8:35 UTC (permalink / raw)
  To: Kjeld Borch Egevang; +Cc: linux-mips mailing list

On Thu, Sep 27, 2001 at 04:59:47PM +0200, Kjeld Borch Egevang wrote:
> When I compile the following function with "gcc -O2" the compiler crashes.
> Is this a known problem?
> 
> static float sp_f2l(float x)
> {
>     long l, *xl;
>     float y;
> 
>     xl = (void *)&y;
>     l = x;
>     *xl = l;
>     return y;
> }
> 
> I use gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-97.2)
> 

I back ported this from gcc in CVS to gcc 2.96. It works for me. It
will be in the next RedHat 7.1/mips update.


H.J.
-----
2001-09-29  H.J. Lu <hjl@gnu.org>

	* gcc/emit-rtl.c (subreg_hard_regno): Comment out dubious code.

--- gcc/emit-rtl.c.subreg	Sat Sep 29 01:21:24 2001
+++ gcc/emit-rtl.c	Sat Sep 29 01:22:06 2001
@@ -734,6 +734,7 @@ subreg_hard_regno (x, check_mode)
 
   final_regno = SUBREG_REGNO (x);
 
+#if 0
   /* Punt if what we end up with is not a valid regno in
      the SUBREG's mode, or we went past the end of the inner
      REG's mode, or we overflow past the last hard regno.  */
@@ -743,6 +744,7 @@ subreg_hard_regno (x, check_mode)
 	   HARD_REGNO_NREGS (base_regno, GET_MODE (reg)))
        || final_regno >= FIRST_PSEUDO_REGISTER)
     abort ();
+#endif
 
   return final_regno;
 }

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-09-29  8:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-09-27 14:59 gcc crash Kjeld Borch Egevang
2001-09-28 12:37 ` Keith Owens
2001-09-28 17:05   ` Ralf Baechle
2001-09-29  8:35 ` H . J . Lu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.