🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #41562

Re: gcc fails Paranoia (numeric) test under Linux

#41562
From: Peter Dalgaard BSA
Date: Fri, 08 Mar 1996 00:00
41 lines
2447 bytes
In article <4hn916$ejs@news.ccit.arizona.edu> schulze@lpl.arizona.edu (Dean Schulze) writes:

       The evidence against gcc 2.7.2 under Linux continues to mount.  I would
   appreciate it if some of you can try this test on your Linux machines.
[....]
   be OK.  However, when I compiled with -O2 paranoia found some serious
   flaws and hung before completing the test.

       I compiled paranoia on the same machine using Visual C++ under
   Windows 95 both with and without optimization and in both cases
   paranoia found no problems and pronounced the arithmetic to be perfect.

       This doesn't prove that my hardware works correctly in all cases, but
   it does show that gcc's optimization is seriously flawed.

Nope. It proves that the other two do lousy floatingpoint
optimization! The paranoia program does some weird things to analyze
the hardware, such as - i forget the details, generic example - adding
2 and then subtracting 1 twice. The optimizer realizes that this is
mathematically a null operation and removes it. This can actually
change the result by amounts of the order of round-off, but optimizers
are allowed to do that. 

Ah. Here's an example from the actual code:

        W = One;
        do  {
                W = W + W;
                Y = W + One;
                Z = Y - W;
                Y = Z - One;
                } while (MinusOne + FABS(Y) < Zero);
        /*.. now W is just big enough that |((W+1)-W)-1| >= 1 ...*/

Note that the three last statements in the loop are mathematically
equivalent to Y=0. Go figure....
-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907
Technical Details
Message-ID: <x2g2bjenp7.fsf@bush.kubism.ku.dk>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <4hn916$ejs@news.ccit.arizona.edu>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,fbe8ee8d82a9766b
X-Google-Attributes: gid11318c,public
X-Google-Thread: 1103af,fbe8ee8d82a9766b
X-Google-Attributes: gid1103af,public
From: pd@kubism.ku.dk (Peter Dalgaard BSA)
Subject: Re: gcc fails Paranoia (numeric) test under Linux
Date: 1996/03/08
Message-ID: <x2g2bjenp7.fsf@bush.kubism.ku.dk>
X-Deja-AN: 142173567
sender: pd@bush.kubism.ku.dk
references: <4hn916$ejs@news.ccit.arizona.edu>
to: schulze@asgard.lpl.arizona.edu
organization: Very little
newsgroups: gnu.gcc.help,comp.os.linux.misc