home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / gnu / gcc / bug / 3239 < prev    next >
Encoding:
Text File  |  1993-01-25  |  1.0 KB  |  41 lines

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cs.wisc.edu!ross
  2. From: ross@cs.wisc.edu (Ross Johnson)
  3. Newsgroups: gnu.gcc.bug
  4. Subject: optimizer bug
  5. Date: 25 Jan 1993 20:10:29 -0500
  6. Organization: GNUs Not Usenet
  7. Lines: 28
  8. Sender: daemon@cis.ohio-state.edu
  9. Approved: bug-gcc@prep.ai.mit.edu
  10. Distribution: gnu
  11. Message-ID: <9301231818.AA09180@american.cs.wisc.edu>
  12.  
  13. /* This program illustrates a bug in the gcc optimizer, version 2.3.3
  14.  * on a DECstation 3100.  Normal execution should return without printing
  15.  * anything and this is the result when compiled without optimization.
  16.  * However, when the -O2 flag is used, this program prints the error message.
  17.  *
  18.  * Ross Johnson (ross@cs.wisc.edu)
  19.  */
  20.  
  21. void
  22. Init(int *var)
  23. {
  24.   *var = 0;
  25. }
  26.  
  27. void
  28. main()
  29. {
  30.   int stuff, count, x = 0;
  31.   char word[] = "c";
  32.  
  33.   Init(&stuff);
  34.   word[count = 0] = (stuff == 0 ? (x=1, 'a') : (x=2, 'b'));
  35.   /* if compared with 'c', the optimized program returns without ERROR */
  36.   if (word[count] == 'a')
  37.     return;
  38.   printf("ERROR: prefix `%s' %d\n", word, x);
  39. }
  40.  
  41.