From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.redhat.com (mail.redhat.com [199.183.24.239]) by listman.redhat.com (Postfix) with ESMTP id 895042F61A for ; Wed, 18 Apr 2001 11:41:07 -0400 (EDT) Received: (from mail@localhost) by mail.redhat.com (8.11.0/8.8.7) id f3IFbjk30810 for axp-list@listman.redhat.com; Wed, 18 Apr 2001 11:37:45 -0400 Received: from elf.theochem.kth.se (elf.theochem.kth.se [130.237.52.51]) by mail.redhat.com (8.11.0/8.8.7) with ESMTP id f3IFbiC30803 for ; Wed, 18 Apr 2001 11:37:44 -0400 Received: from beta.theochem.kth.se (IDENT:root@beta.theochem.kth.se [130.237.52.99]) by elf.theochem.kth.se (8.9.3/8.9.3) with ESMTP id RAA10169 for ; Wed, 18 Apr 2001 17:40:51 +0200 Received: (from pawsa@localhost) by beta.theochem.kth.se (8.9.3/8.9.3) id RAA04765 for axp-list@redhat.com; Wed, 18 Apr 2001 17:40:48 +0200 Date: Wed, 18 Apr 2001 17:40:47 +0200 From: Pawel Salek To: axp-list@redhat.com Subject: Re: gcc 2.96 optimization bug on RedHat7.0/alpha Message-ID: <20010418174047.C3496@beta.theochem.kth.se> References: <3ADDAF37.18D256A1@voicenet.com> <200104180432.XAA03440@zakon.math.purdue.edu> <32631.987602624@redhat.com> <3ADDCA70.ACA7A70C@voicenet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 In-Reply-To: <3ADDCA70.ACA7A70C@voicenet.com>; from gatgul@voicenet.com on Wed, Apr 18, 2001 at 19:10:08 +0200 X-Mailer: Balsa 1.1.3 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.redhat.com id f3IFbiC30803 X-Loop: axp-list@redhat.com Sender: axp-list-admin@redhat.com Errors-To: axp-list-admin@redhat.com X-BeenThere: axp-list@redhat.com X-Mailman-Version: 2.0.1 Precedence: bulk Reply-To: axp-list@redhat.com List-Help: List-Post: List-Subscribe: , List-Id: Linux and Red Hat on Alpha processors List-Unsubscribe: , List-Archive: On 2001-04-18 19:10 Uncle George wrote: > I'm sorry that u believe this but i believe that the results from > > -O0 == -O1 == -O2 == -O3 == -O4 > > should all be the same. Well, I am not sure if I do right rebutting this claim but the simplest proof of your misunderstanding of the problem is the following program: #include int main() { float f = 1.0/3.0; printf("%20.10f\n", f+f+f); return 0; } compiled with gcc t.c and gcc -O t.c (actually, the compiler should not matter). Straightforward compilation without compilation will produce result different from 1 due to rounding errors; gcc -O will detect that it can get rid of the addition and the result will be equal to 1 - as expected(?). The code is correct when it follows the standard, not matter how it is interpreted. if the code depends on the interpretation, the code _is_ broken. I have seen quite many broken Fortran programs written by chemists that believed they knew the language so I think I know what I am talking about. if you don't care about standards, don't be suprized that you waste your time finding errors in compilers. just my 0.02zlp /Pawel -- Pawel Salek (pawsa@theochem.kth.se) http://www.theochem.kth.se/~pawsa/ Theoretical Chemistry Division, KTH voice: +46 8 790-8202