public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c/5926: gcc 3.0.3 generates incorrect code with -O3 option
@ 2002-03-18 22:26 Guillermo Ballester Valor
  0 siblings, 0 replies; 5+ messages in thread
From: Guillermo Ballester Valor @ 2002-03-18 22:26 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c/5926; it has been noted by GNATS.

From: Guillermo Ballester Valor <gbv@oxixares.com>
To: jakub@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
   nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: c/5926: gcc 3.0.3 generates incorrect code with -O3 option
Date: Tue, 19 Mar 2002 07:16:27 +0100

 Hi, 
 
 I've just now repeated the test again with my i586, compiled with 'gcc -O3 
 testbug.c -o testbug' , gcc 3.0.3 and the result is:
 
 Results of no bugy routine 1780
 Results of bugy routine 238611074
 
 
 And I remember to have the same problems since gcc 3.0. On a pentium III the 
 problems are the same.
 
 Guillermo.
 
 On Tue 19 Mar 2002 00:47, jakub@gcc.gnu.org wrote:
 > Synopsis: gcc 3.0.3 generates incorrect code with -O3 option
 >
 > State-Changed-From-To: open->analyzed
 > State-Changed-By: jakub
 > State-Changed-When: Mon Mar 18 15:47:21 2002
 > State-Changed-Why:
 >     Cannot reproduce this with any of
 >     gcc 3.0.4, gcc 3.1 20020314 and gcc 3.0.2 20011002,
 >     with -O3 for -march=i386, -march=i586 nor -march=i386 -mcpu=i586.
 >
 > http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&
 >pr=5926
 
 -- 
 Guillermo Ballester Valor
 gbv@oxixares.com
 Granada (Spain)
 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: c/5926: gcc 3.0.3 generates incorrect code with -O3 option
@ 2003-01-01 19:08 neroden
  0 siblings, 0 replies; 5+ messages in thread
From: neroden @ 2003-01-01 19:08 UTC (permalink / raw)
  To: gbv, gcc-bugs, gcc-prs, nobody

Synopsis: gcc 3.0.3 generates incorrect code with -O3 option

State-Changed-From-To: analyzed->closed
State-Changed-By: neroden
State-Changed-When: Wed Jan  1 11:08:56 2003
State-Changed-Why:
    Just can't reproduce with any current version.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5926


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: c/5926: gcc 3.0.3 generates incorrect code with -O3 option
@ 2002-04-29  0:26 gbv
  0 siblings, 0 replies; 5+ messages in thread
From: gbv @ 2002-04-29  0:26 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 653 bytes --]

The following reply was made to PR c/5926; it has been noted by GNATS.

From: "gbv" <gbv@inm.es>
To: gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org,
	 gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org, gbv@oxixares.com
Cc:  
Subject: Re: c/5926: gcc 3.0.3 generates incorrect code with -O3 option
Date: Mon, 29 Apr 2002 09:20:37 +0200

 Hi,
 
 Fortunately, the problem has dissapeared in gcc-3.1 20020422 snapshot.
 
 Actually this is the first 3.1 snapshot I've tried. So the offending code has 
 been fixed in any moment between 3.0.4 and 3.1
 
 Guillermo.
 
 -- 
 Guillermo Ballester Valor
 OMD B.A. Armilla (Granada)
 Instituto Nacional de Meteorología
 SPAIN


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: c/5926: gcc 3.0.3 generates incorrect code with -O3 option
@ 2002-03-18 15:47 jakub
  0 siblings, 0 replies; 5+ messages in thread
From: jakub @ 2002-03-18 15:47 UTC (permalink / raw)
  To: gbv, gcc-bugs, gcc-prs, nobody

Synopsis: gcc 3.0.3 generates incorrect code with -O3 option

State-Changed-From-To: open->analyzed
State-Changed-By: jakub
State-Changed-When: Mon Mar 18 15:47:21 2002
State-Changed-Why:
    Cannot reproduce this with any of
    gcc 3.0.4, gcc 3.1 20020314 and gcc 3.0.2 20011002,
    with -O3 for -march=i386, -march=i586 nor -march=i386 -mcpu=i586.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5926


^ permalink raw reply	[flat|nested] 5+ messages in thread

* c/5926: gcc 3.0.3 generates incorrect code with -O3 option
@ 2002-03-12 12:06 gbv
  0 siblings, 0 replies; 5+ messages in thread
From: gbv @ 2002-03-12 12:06 UTC (permalink / raw)
  To: gcc-gnats


>Number:         5926
>Category:       c
>Synopsis:       gcc 3.0.3 generates incorrect code with -O3 option
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Tue Mar 12 12:06:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Guillermo Ballester Valor
>Release:        3.0.3
>Organization:
>Environment:
System: Linux mozart 2.2.19 #2 Sat Jun 2 21:32:31 CEST 2001 i586 unknown
Architecture: i586

	
host: i586-pc-linux-gnu
build: i586-pc-linux-gnu
target: i586-pc-linux-gnu
configured with: ./configure 
>Description:
	I've detected a problem when updated from gcc 2.95.2 . A result was different depending on the 
	order of a line of code were written, without aparent cause, when using -O3 
>How-To-Repeat:
	See the problem compiling the following code with -O3 option. The two routines are the same but
	a code of line changed. I think both results would be the same but I get different resuts.

-----------------------------------
 
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

size_t last_nsize=0;
#define BITS_PER_LIMB 32

unsigned long Y_MASQ,Y_LIMB,Y_MAX,Y_BITS;
double Y_TINV;

int bugy_routine(size_t n1, size_t n2)
{
  size_t n,nsize,needed=0,i;
 
  nsize= n1 + n2;

  /*See whether all the initialization work con be avoided */
  needed=(nsize*BITS_PER_LIMB);
  Y_BITS = (unsigned long)((double)24.00 - 0.5*log((double)needed));
  Y_MASQ=((1U<<Y_BITS)-1L);
  Y_LIMB=(1U<<Y_BITS);
  Y_MAX=(1U<<(Y_BITS-1));
  Y_TINV=1.0/(double)Y_LIMB;
  needed=(needed-1)/(size_t)Y_BITS+3; /****** LINE CHANGED *******/
  return needed;
}

int nobugy_routine(size_t n1, size_t n2)
{
  size_t n,nsize,needed=0,i;
  int save;
  
  nsize= n1 + n2;

  /*See whether all the initialization work con be avoided */
  needed=(nsize*BITS_PER_LIMB);
  Y_BITS = (unsigned long)((double)24.00 - 0.5*log((double)needed));
  needed=(needed-1)/(size_t)Y_BITS+3; /****** LINE CHANGED *******/
  Y_MASQ=((1U<<Y_BITS)-1L);
  Y_LIMB=(1U<<Y_BITS);
  Y_MAX=(1U<<(Y_BITS-1));
  Y_TINV=1.0/(double)Y_LIMB;
  return needed;
}

int main(int argc, char **argv)
{
  size_t n1=500, n2=500, res1, res2;
  
  res1=nobugy_routine(n1,n2);
  printf("Results of no bugy routine %i\n",res1);
  res2=bugy_routine(n1,n2);
  printf("Results of bugy routine %i\n",res2);
}

------------------------------------------

>Fix:

I don't know
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-01-01 19:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-18 22:26 c/5926: gcc 3.0.3 generates incorrect code with -O3 option Guillermo Ballester Valor
  -- strict thread matches above, loose matches on Subject: below --
2003-01-01 19:08 neroden
2002-04-29  0:26 gbv
2002-03-18 15:47 jakub
2002-03-12 12:06 gbv

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