home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / gnu / gcc / bug / 2201 < prev    next >
Encoding:
Text File  |  1992-08-27  |  2.3 KB  |  62 lines

  1. Newsgroups: gnu.gcc.bug
  2. Path: sparky!uunet!cis.ohio-state.edu!watson.ibm.com!c$dje
  3. From: c$dje@watson.ibm.com (David Edelsohn)
  4. Subject: gcc-2.2.2 crash -- int ternary operator indexing character array
  5. Message-ID: <9208271739.AA36908@tweetie.watson.ibm.com>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: GNUs Not Usenet
  8. Distribution: gnu
  9. Date: Thu, 27 Aug 1992 17:39:50 GMT
  10. Approved: bug-gcc@prep.ai.mit.edu
  11. Lines: 49
  12.  
  13.     I previously reported this as a general bug in gcc-2.2.2 that
  14. causes a fatal signal 11 internal error in gcc-2.2.2 with an extensive code
  15. fragment.  I have tracked the problem further to a specific type of
  16. expression -- a ternary operator testing an integer variable with the same
  17. variable also used as the resulting index into a character array.  The
  18. following code fragment will crash gcc-2.2.2 with a fatal signal 11
  19. internal error on the following types of machines:
  20.  
  21.     Digital DECstations running Ultrix 4.2A
  22.     IBM Risc System/6000s running AIX 3.1 and 3.2.
  23.     Sun Sparcstations running SunOS 4.1.2
  24.  
  25.  
  26. int main()
  27. {
  28.     unsigned char this[64];
  29.     unsigned char other;
  30.     unsigned int index;
  31.  
  32.     other = this[index < 64 ? index : 0];
  33.  
  34.     exit(0);
  35. }
  36.  
  37.  
  38. If either use of index is changed to another variable, the program will
  39. compile without incident.  Also, if index is changed to a character type,
  40. the program will compile.
  41.     Appended is a verbose compilation for an AIX system.  I would
  42. appreciate a patch for gcc to fix this problem.
  43.  
  44.                 Thanks, David
  45.  
  46. % gcc -v -c foobar.c
  47. Reading specs from /contrib/lib/gcc-lib/rs6000/2.2/specs
  48. gcc version 2.2
  49.  /contrib/lib/gcc-lib/rs6000/2.2/cpp -lang-c -v -undef -D__GNUC__=2 -D_IBMR2 -D_AIX -D___IBMR2__ -D___AIX__ -D___IBMR2 -D___AIX -D__CHAR_UNSIGNED__ foobar.c /tmp/ccW8cCrx.i
  50. GNU CPP version 2.2
  51.  /contrib/lib/gcc-lib/rs6000/2.2/cc1 /tmp/ccW8cCrx.i -quiet -dumpbase foobar.c -version -o /tmp/ccW8cCrx.s
  52. GNU C version 2.2.2 compiled by GNU C version 2.2.
  53. gcc: Internal compiler error: program cc1 got fatal signal 11
  54.  
  55. ===============================================================================
  56. David Edelsohn                                      T.J. Watson Research Center
  57. c$dje@watson.ibm.com                                P.O. Box 218
  58. +1 914 945 3011 (Tieline 862)                       Yorktown Heights, NY 10598
  59. "If G-D had wanted us to vote, he would have given us candidates" -- Jay Leno
  60.  
  61.  
  62.