*BSD News Article 16605


Return to BSD News archive

Xref: sserve comp.os.386bsd.development:810 comp.os.386bsd.misc:406 comp.unix.sysv386:27276 gnu.gcc.help:4646 comp.unix.pc-clone.32bit:3055 comp.sys.intel:5552
Newsgroups: comp.os.386bsd.development,comp.os.386bsd.misc,comp.unix.sysv386,gnu.gcc.help,comp.unix.pc-clone.32bit,comp.sys.intel
Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!saimiri.primate.wisc.edu!usenet.coe.montana.edu!netnews.nwnet.net!serval!hlu
From: hlu@eecs.wsu.edu (HJ Lu)
Subject: [Q]: Should 386+387 and 486 give the same result?
Message-ID: <1993May28.214019.8599@serval.net.wsu.edu>
Sender: news@serval.net.wsu.edu (USENET News System)
Organization: School of EECS, Washington State University
Date: Fri, 28 May 93 21:40:19 GMT
Lines: 33

Could someone please run the enclosed code on i486 or i386 with gcc
2.4.1? I'd like to know your assembly output. I am working on Linux.
I found out the same piece of code, gcc 2.4.0 produced

	fldz
	fld1
	fdivp %st,%st(1)

if I use

gcc -S -O test.c

on 386+387. But gcc would just push "Infinity" onto the stack directly
when I ran it on 486. I thought gcc on 386+387 and 486 should produce
the same result. Somehow I got different answers. I was wondering if
that was just limited to Linux. Please tell me your assembly output,
OS, CPU, FPU and gcc version.


Thanks a lot.


H.J.
--------test.c------
#include <stdio.h>

main ()
{
  double z = 0;
  double x = 1.0 / z;

  printf ("1.0 / 0.0 == %lf\n", x);
}