home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cs.wisc.edu!ross
- From: ross@cs.wisc.edu (Ross Johnson)
- Newsgroups: gnu.gcc.bug
- Subject: optimizer bug
- Date: 25 Jan 1993 20:10:29 -0500
- Organization: GNUs Not Usenet
- Lines: 28
- Sender: daemon@cis.ohio-state.edu
- Approved: bug-gcc@prep.ai.mit.edu
- Distribution: gnu
- Message-ID: <9301231818.AA09180@american.cs.wisc.edu>
-
- /* 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);
- }
-
-