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

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).