public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* An alpha IEEE bug
@ 1998-02-07 12:43 RHS Linux User
  1998-02-07 14:47 ` Richard Henderson
  1998-02-09  2:33 ` Klaus Kaempf
  0 siblings, 2 replies; 5+ messages in thread
From: RHS Linux User @ 1998-02-07 12:43 UTC (permalink / raw)
  To: egcs; +Cc: rth

Hi,

There is a bug in the IEEE math on linux/alpha:

# gcc -mieee ieee.c
# a.out
7f800000
1
# gcc -mieee ieee.c -O
# a.out
zsh: 744 abort      ./a.out
# gdb a.out
GDB is free software and you are welcome to distribute copies of it
 under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for GDB; type "show warranty" for details.
GDB 4.16 (alpha-redhat-linux), Copyright 1996 Free Software Foundation, Inc...
(gdb) b isinff
Breakpoint 1 at 0x120000780: file ieee.c, line 16.
(gdb) r
Starting program: /home/work/alpha/bugs/math/a.out

Breakpoint 1, isinff (x=Erroneous arithmetic operation.) at ieee.c:16
16        if (ix == 0)
(gdb)

Can someone please run this on other alpha platforms?


Thanks.


-- 
H.J. Lu (hjl@gnu.org)
----
#include <stdio.h>

typedef int int32_t __attribute__ ((__mode__ (  __SI__ ))) ;
typedef union
{
  float value;
  int32_t word;
} ieee_float_shape_type;

int isinff(float x)
{
  int32_t ix,t;
  ieee_float_shape_type gf_u;
  gf_u.value = x;
  ix = gf_u.word;
  if (ix == 0)
    abort ();
  else
    printf ("%x\n", ix);
  t = ix & 0x7fffffff;
  t ^= 0x7f800000;
  t |= -t;
  return ~(t >> 31) & (1 - ((ix & 0x80000000) >> 30));
}

main ()
{
  float x = 1.0 / 0.0;

  printf ("%d\n", isinff (x));
  return 0;
}

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

* Re: An alpha IEEE bug
  1998-02-07 12:43 An alpha IEEE bug RHS Linux User
@ 1998-02-07 14:47 ` Richard Henderson
  1998-02-09  2:33 ` Klaus Kaempf
  1 sibling, 0 replies; 5+ messages in thread
From: Richard Henderson @ 1998-02-07 14:47 UTC (permalink / raw)
  To: RHS Linux User; +Cc: egcs, rth

On Sat, Feb 07, 1998 at 12:28:16PM -0800, RHS Linux User wrote:
> There is a bug in the IEEE math on linux/alpha:

It is a bug in combine.  Look at -O without -mieee -- it doesn't
abort but it gives wrong results.

I'll see what I can do.


r~

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

* Re: An alpha IEEE bug
  1998-02-07 12:43 An alpha IEEE bug RHS Linux User
  1998-02-07 14:47 ` Richard Henderson
@ 1998-02-09  2:33 ` Klaus Kaempf
  1998-02-09 14:22   ` Richard Henderson
  1 sibling, 1 reply; 5+ messages in thread
From: Klaus Kaempf @ 1998-02-09  2:33 UTC (permalink / raw)
  To: RHS Linux User; +Cc: egcs

> 
> Hi,
> 
> There is a bug in the IEEE math on linux/alpha:
> 
> # gcc -mieee ieee.c
> # a.out
> 7f800000
> 1
> # gcc -mieee ieee.c -O
> # a.out
> zsh: 744 abort      ./a.out

On openVMS/Alpha I get a different output (without optimization):

3f800000
0

It also calls abort() when compiled with optimization.

Klaus
-- 
proGIS Software                 E-Mail: kkaempf@progis.de
Dipl.-Inform. Klaus K"ampf      Fax:    0241-47067-29
Jakobstr. 117                   Voice:  0241-47067-11
D-52064 Aachen                  WWW:	http://www.progis.de


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

* Re: An alpha IEEE bug
  1998-02-09  2:33 ` Klaus Kaempf
@ 1998-02-09 14:22   ` Richard Henderson
  1998-02-10  0:53     ` Klaus Kaempf
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Henderson @ 1998-02-09 14:22 UTC (permalink / raw)
  To: Klaus Kaempf; +Cc: RHS Linux User, egcs

On Mon, Feb 09, 1998 at 11:27:24AM +0100, Klaus Kaempf wrote:
> On openVMS/Alpha I get a different output (without optimization):
> 
> 3f800000
> 0

OpenVMS uses F and G format floats, no?

> It also calls abort() when compiled with optimization.

Probably the same combine problem though.


r~

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

* Re: An alpha IEEE bug
  1998-02-09 14:22   ` Richard Henderson
@ 1998-02-10  0:53     ` Klaus Kaempf
  0 siblings, 0 replies; 5+ messages in thread
From: Klaus Kaempf @ 1998-02-10  0:53 UTC (permalink / raw)
  To: rth; +Cc: egcs

> 
> On Mon, Feb 09, 1998 at 11:27:24AM +0100, Klaus Kaempf wrote:
> > On openVMS/Alpha I get a different output (without optimization):
> > 
> > 3f800000
> > 0
> 
> OpenVMS uses F and G format floats, no?
> 
No ! GNU C on openVMS/Alpha uses IEEE floats, I never tried to get it running
with the old VAX floating formats.

-- 
proGIS Software                 E-Mail: kkaempf@progis.de
Dipl.-Inform. Klaus K"ampf      Fax:    0241-47067-29
Jakobstr. 117                   Voice:  0241-47067-11
D-52064 Aachen                  WWW:	http://www.progis.de


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

end of thread, other threads:[~1998-02-10  0:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-02-07 12:43 An alpha IEEE bug RHS Linux User
1998-02-07 14:47 ` Richard Henderson
1998-02-09  2:33 ` Klaus Kaempf
1998-02-09 14:22   ` Richard Henderson
1998-02-10  0:53     ` Klaus Kaempf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).