🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #1670

GCC v 1.28 bug

#1670
From: Peter Nuth
Date: Tue, 20 Sep 1988 20:29
41 lines
1316 bytes

/* Program fail.c - to demonstrate bug in GNU C compiler version 1.28 */
/* by nuth@wheaties.ai.mit.edu */
/* Compile using "gcc fail.c " */
/* Works correctly if you use "gcc -O fail.c" */
/* Compiled on sun-3 in the MIT AI lab. */

/* Generates incorrect assembly code -  */
/*   "gcc -S fail.c" shows this */

struct foober {
  int x;
  struct small *a;
};

struct small {
  int x;
  unsigned char t[50];
  unsigned char d[50];
};

struct foober afoob;
struct small asmall;

int main()
{
  struct foober *m;
  int rt, rd, offset = 12;	/* Assigning chars to ints should work */
  unsigned char nrt;
  m = &afoob;
  m->a = &asmall;
  m->a->t[offset] = 30;
				/* Bug here in code generation */
  rt = (int) m->a->t[offset] ;	/* rt does not get assigned */

  nrt = m->a->t[offset] ;
  printf("rt = %x ", rt);
  printf("nrt = %x ", nrt);
  printf("should be rt = %x\n", m->a->t[offset]) ;
}
Technical Details
Message-ID: <8809202029.AA01554@wheat-germ.ai.mit.edu>
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!lll-winken!killer!osu-cis!tut.cis.ohio-state.edu!WHEATIES.AI.MIT.EDU!nuth

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!lll-winken!killer!osu-cis!tut.cis.ohio-state.edu!WHEATIES.AI.MIT.EDU!nuth
From: nuth@WHEATIES.AI.MIT.EDU (Peter Nuth)
Newsgroups: gnu.gcc.bug
Subject: GCC v 1.28 bug
Message-ID: <8809202029.AA01554@wheat-germ.ai.mit.edu>
Date: 20 Sep 88 20:29:20 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 40