🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Peter Nuth Tue, 20 Sep 1988 20:29
GCC v 1.28 bug
#1670
Author: 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]) ;
}
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads