GCC 2.7.2 strength-reduce how serious is it ??

GCC 2.7.2 strength-reduce how serious is it ??

Post by Gerhard Ahu » Fri, 19 Jul 1996 04:00:00



How serious is this bug. I compiled a lot of programs without problems so
far. What problems should I expect ??

Thanks in advance,

Gerhard.

 
 
 

GCC 2.7.2 strength-reduce how serious is it ??

Post by Nat Makarevitc » Sun, 21 Jul 1996 04:00:00


Quote:Gerhard Ahuis writes:
> How serious is this bug.

/*Organization: Northeastern University, College of Computer Science
Date: 07 Jan 1996 20:17:47 +0100

Subject: gcc bug reminder
Newsgroups: comp.os.linux.announce
Followup-To: comp.os.linux.development.system
Lines: 96


NNTP-Posting-Host: kruuna.helsinki.fi
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit

-----BEGIN PGP SIGNED MESSAGE-----
*/
/* sr_bug.c
 *
 * This program tests for a gcc bug.
 * To compile this test program:  gcc -O2 sr_bug.c
 *
 * Sometimes gcc for Intel CPUs generates bad code at optimization
 * level 2.  The bad code is 'almost right' and stay hidden inside
 * a program that seems to work - including the Linux kernel.
 * The bug is very old and has been reported.  As of 19-Dec-95,
 * the bug has not been fixed.
 *
 * If you change this code you should test it, because even a
 * tiny change will hide this elusive bug.  If you think you
 * fixed the bug, please run the original test just to make
 * sure. You can find the original test below, after the #if 0.
 * I wrote this version of the test to be user-friendly, and
 * it may not be as solid as the original.
 *
 * Some people who know more than I do:



 *
 * User-friendly version by Albert Cahalan
 *
 */

#include <stdio.h>

int gcc_sr_bug(void){
  static int Array[3]; /* must be static (or global) */
  unsigned int B = 3;  /* must be unsigned 32-bit */
  int i;
  for(i=0; i<B; i++) Array[i] = i - 3;
  for(i=0; i<B; i++) printf(" %d,%d", i, Array[i]);
  return !Array[1];

Quote:}

int main(){
  printf("Testing for gcc bug...");
  if(gcc_sr_bug()){
    printf("\n\nBad code! Your compiler generates bad output.\n\n");
    printf("Add -fno-strength-reduce to your gcc command line\n");
    printf("or put it into your gcc config file, such as in\n");
    printf("/usr/lib/gcc-lib/i486-linux/2.7.0/specs.\n");
    exit(1);
  }else{
    printf("\nOK, no problem.\n");
    exit(0);
  }

Quote:}

#if 0
/*********  original code + whitespace  ***********/

#include <stdio.h>

int A[3];
unsigned int B = 3;

void printit(void){
  int i;
  for(i = 0; i < B; i++) fprintf(stdout, "A[%d] = %d\n", i, A[i]);

Quote:}

int main(){
  int i;
  for(i = 0; i < B; i++) A[i] = i - 3;
  printit();
  return 0;

Quote:}

#endif
/*- --

Albert Cahalan

*/

--
Nat    Linux

 
 
 

GCC 2.7.2 strength-reduce how serious is it ??

Post by John E. Dav » Tue, 23 Jul 1996 04:00:00




 : How serious is this bug. I compiled a lot of programs without problems so
 : far. What problems should I expect ??

I discovered it while developing a a program that modeled diffraction
gratings.  The program never core-dumped; it just gave wrong answers.
I regard it as much more serious than the famous pentium division bug.

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

 
 
 

1. strength-reduce and GCC

Could someone give me the status of the strength-reduce feature
of GCC on ix86 processors, or point me to this information.

Ie, on which versions is -fno-strenght-reduce needed to produce
correct code?
On which versions is -fno-strength-reduce the default, and on
which is strenght-reduce disabled?
Is any versions of egcs/pgcc affected?

//Marcus
--
-------------------------------+------------------------------------
        Marcus Sundberg        | http://www.stacken.kth.se/~mackan/
 Royal Institute of Technology |       Phone: +46 707 295404

2. Remote server monitoring software

3. gcc 2.7.2.1 & strength reduce bug?

4. parent procress

5. gcc 2.7.2 & -fno-strength-reduce bug?

6. PPP internet connect problems

7. Q:Kernel compiled with no -fno-strength-reduce??

8. Wanted help on TCP/IP sockets !

9. importance of -fno-strength-reduce

10. Strength reduce bug - has it been fixed?

11. Wine is affected by the reduce-strength-bug

12. Strength reduce bug - has it been fixed?

13. BBN, industrial strength Interne provider, needs UNIX sysadmins, Cambridge, AM