🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #2450

(none)

#2450
From: Zonnie Lee Williamson
Date: Wed, 22 Mar 1989 17:18
53 lines
1197 bytes
/* optimizer bug in GCC 1.34 on Sun 3/50 */
/* when compiled with the -O switch, the code fails (prints "BUG") */
/* when compiled without -O, it works fine (prints "OK") */

main()
{
  int x1;
  int x2;
  int x3;
  struct {
    int x;
    int y;
  } v1, v2, v3, v4, v5;


  x1 = 3;
  x3 = 7;
  x2 = 3;

  v1.x = 0;
  v1.y = 1;
  
  v4.x = 65;
  v4.y = 15;
  
  v5.x = 58;
  v5.y = 19;

  v3.y = 0;
  v3.x = v4.x < v5.x ? 1 : -1;

  v2.x = v4.x;
  v2.y = v4.y;

  for (; x1 > 0; x1--) {

    v2.x += v1.x;
    v2.y += v1.y;

    if (x1 == x2 && x3 > 0) while(x3--) {
      v2.x += v3.x;
      v2.y += v3.y;
    }

  }

  v2.x += v1.x;
  v2.y += v1.y;

  if (!(v2.x == v5.x && v2.y == v5.y)) printf("BUG\n");
  else printf("OK\n");

}
Technical Details
Message-ID: <Added.UY9xKyy00Ui3MTgk5F@andrew.cmu.edu>
Path: arc1-ca.pugleaf.net!utzoo!yunexus!telly!attcan!uunet!tut.cis.ohio-state.edu!ANDREW.CMU.EDU!zon+

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!yunexus!telly!attcan!uunet!tut.cis.ohio-state.edu!ANDREW.CMU.EDU!zon+
From: zon+@ANDREW.CMU.EDU (Zonnie Lee Williamson)
Newsgroups: gnu.gcc.bug
Subject: (none)
Message-ID: <Added.UY9xKyy00Ui3MTgk5F@andrew.cmu.edu>
Date: 22 Mar 89 17:18:16 GMT
Article-I.D.: andrew.Added.UY9xKyy00Ui3MTgk5F
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 53