[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#40189: marked as done ([PR c/6889] gcc produces incorrect minimization code)



Your message dated Fri, 27 Dec 2002 17:05:03 +0100
with message-id <15884.31279.862427.431948@gargle.gargle.HOWL>
and subject line Bug#40189: c/6898: gcc produces incorrect minimization code
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--------------------------------------
Received: (at submit) by bugs.debian.org; 25 Jun 1999 19:34:28 +0000
Received: (qmail 28888 invoked from network); 25 Jun 1999 19:34:27 -0000
Received: from enhanced.ppp.eticomm.net (HELO intech19.enhanced.com) (@206.228.183.5)
  by master.debian.org with SMTP; 25 Jun 1999 19:34:27 -0000
Received: from camm by intech19.enhanced.com with local (Exim 2.05 #1 (Debian))
	id 10xbk0-0008C0-00; Fri, 25 Jun 1999 15:34:24 -0400
From:  <camm@enhanced.com>
Subject: egcc: egcc produces incorrect minimization code
To: submit@bugs.debian.org
X-Mailer: bug 3.1.7
Message-Id: <E10xbk0-0008C0-00@intech19.enhanced.com>
Date: Fri, 25 Jun 1999 15:34:24 -0400

Package: egcc
Version: 2.91.60-5

The following program inconsistently chooses minimal
array elements in case of equal elements being present.

Here is the code (ttr.c):
------------------------
#include <stdio.h>
#include <math.h>


int
main() {

  double a[4]={0.006776,2.5,3.0,0.006776},w[4]={0.000030,3.7,3.0,0.000030},t,amin;
  int ir,i,nr=4;
  double tol=9.31322574615479e-10*3.0;

  for (i=0,ir=-1,amin=DBL_MAX;i<nr;i++) 
    if (a[i]>tol) {
      t=w[i]/a[i];
      if (t<amin || ir==-1) {
	amin=t;
	ir=i;
      }
    }
  
  printf("ir=%d\n",ir);

  for (i=0,ir=-1,amin=DBL_MAX;i<nr;i++) 
    if (a[i]>tol && ((t=w[i]/a[i])<amin || ir==-1)) {
	amin=t;
	ir=i;
      }
  
  printf("ir=%d\n",ir);

  exit(0);

}
---------------  
and here is the execution:
---------------
intech19:~$ egcc -g -Wall ttr.c -o ttr -lm
intech19:~$ ./ttr
ir=0
ir=3
-----------------




-- System Information
Debian Release: 2.1
Kernel Version: Linux intech19 2.2.7 #1 SMP Thu May 27 11:53:43 EDT 1999 i686 unknown

Versions of the packages egcc depends on:
ii  libc6           2.0.7.19981211 GNU C Library: shared libraries
ii  g++             2.91.60-5      The GNU (egcs) C++ compiler.
ii  g++             2.91.60-5      The GNU (egcs) C++ compiler.
---------------------------------------
Received: (at 40189-done) by bugs.debian.org; 27 Dec 2002 16:08:02 +0000
>From doko@cs.tu-berlin.de Fri Dec 27 10:08:01 2002
Return-path: <doko@cs.tu-berlin.de>
Received: from mail.cs.tu-berlin.de [130.149.17.13] (root)
	by master.debian.org with esmtp (Exim 3.12 1 (Debian))
	id 18Rx1j-0001Al-00; Fri, 27 Dec 2002 10:07:59 -0600
Received: from bolero.cs.tu-berlin.de (daemon@bolero.cs.tu-berlin.de [130.149.19.1])
	by mail.cs.tu-berlin.de (8.9.3/8.9.3) with ESMTP id RAA00973
	for <40189-done@bugs.debian.org>; Fri, 27 Dec 2002 17:05:04 +0100 (MET)
Received: (from doko@localhost)
	by bolero.cs.tu-berlin.de (8.11.6+Sun/8.9.3) id gBRG54w08658;
	Fri, 27 Dec 2002 17:05:04 +0100 (MET)
From: Matthias Klose <doko@cs.tu-berlin.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-ID: <15884.31279.862427.431948@gargle.gargle.HOWL>
Date: Fri, 27 Dec 2002 17:05:03 +0100
To: 40189-done@bugs.debian.org
Subject: Re: Bug#40189: c/6898: gcc produces incorrect minimization code
In-Reply-To: <20021122164701.6181.qmail@sources.redhat.com>
References: <20021122164701.6181.qmail@sources.redhat.com>
X-Mailer: VM 7.03 under 21.4 (patch 6) "Common Lisp" XEmacs Lucid
Delivered-To: 40189-done@bugs.debian.org
X-Spam-Status: No, hits=-8.9 required=5.0
	tests=IN_REP_TO,QUOTED_EMAIL_TEXT,REFERENCES,SPAM_PHRASE_01_02
	version=2.41
X-Spam-Level: 

therefore closing ...

reichelt@igpm.rwth-aachen.de writes:
> Synopsis: gcc produces incorrect minimization code
> 
> State-Changed-From-To: open->closed
> State-Changed-By: reichelt
> State-Changed-When: Fri Nov 22 08:47:00 2002
> State-Changed-Why:
>     Not a bug.
>     
>     Whether you get ir=0 or ir=3 is just a matter when rounding will take place.
>     Since the code is rearranged in optimization steps, you'll get varying
>     results with different architectures and optimization options. Similar
>     but not identical code might also lead to different results.
>     Welcome to the world of floating point arithmetic.
>     
>     BTW, declaring t and amin as "volatile double" leads to your "expected"
>     result even for -O0.
> 
> http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6898



Reply to: