www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/06/12/00:32:33

Xref: news2.mv.net comp.os.msdos.djgpp:4864
From: davis AT space DOT mit DOT edu (John E. Davis)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: GCC fstrength-reduce bug
Date: 12 Jun 1996 02:21:18 GMT
Organization: Center for Space Research
Lines: 47
Message-ID: <slrn4rsacu.20t.davis@aluche.mit.edu>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 960611113905 DOT 4911D-100000 AT is>
Reply-To: davis AT space DOT mit DOT edu
NNTP-Posting-Host: aluche.mit.edu
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On Tue, 11 Jun 1996 09:43:15 GMT, Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
wrote:
 : That's why lib/specs in DJGPP disables that optimization.  You have to 
 : use -fstrength-reduce on the gcc command line to switch it on.
 : 
 : > Also is gcc v2.6.3 got this bug?
 : 
 : No.
 
Is this really true?  I was the person who first found the bug while using
2.5.4 under Linux.  I upgraded to 2.6.3 and the bug was still there.  It is
my understanding that the bug afflicts all versions of gcc on intel.

For what it is worth, here is some code that illustrates the bug.  Compile
and run it using `gcc -O2 -fno-strength-reduce' and 
`gcc -O2 -fstrength-reduce'.

#include <stdio.h>
int I[3];
unsigned int Num_I = 3;

void print_i (void)
{
   unsigned int j;
   for (j = 0; j < 3; j++)
     {
	fprintf (stderr, "I[%d] = %d\n", j, I[j]);
     }
}

int main ()
{
   unsigned int j;
   
   for (j = 0; j < Num_I; j++)
     {
	I[j] = (int)j - 3;
     }
   print_i ();
   return 0;
}

-- 
John E. Davis                   Center for Space Research/AXAF Science Center
617-258-8119                    MIT 37-662c, Cambridge, MA 02139
http://space.mit.edu/~davis

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019