🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Ross Johnson Tue, 26 Jan 1993 01:10
optimizer bug
#1648
Author: Ross Johnson
Date: Tue, 26 Jan 1993 01:10
27 lines
1091 bytes
/* This program illustrates a bug in the gcc optimizer, version 2.3.3
 * on a DECstation 3100.  Normal execution should return without printing
 * anything and this is the result when compiled without optimization.
 * However, when the -O2 flag is used, this program prints the error message.
 *
 * Ross Johnson (ross@cs.wisc.edu)
 */

void
Init(int *var)
{
  *var = 0;
}

void
main()
{
  int stuff, count, x = 0;
  char word[] = "c";

  Init(&stuff);
  word[count = 0] = (stuff == 0 ? (x=1, 'a') : (x=2, 'b'));
  /* if compared with 'c', the optimized program returns without ERROR */
  if (word[count] == 'a')
    return;
  printf("ERROR: prefix `%s' %d\n", word, x);
}
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