Article View: gnu.gcc.bug
Article #1007gcc-2.2.2 crash -- int ternary operator indexing character array
From: David Edelsohn
Date: Thu, 27 Aug 1992 17:39
Date: Thu, 27 Aug 1992 17:39
47 lines
2420 bytes
2420 bytes
I previously reported this as a general bug in gcc-2.2.2 that
causes a fatal signal 11 internal error in gcc-2.2.2 with an extensive code
fragment. I have tracked the problem further to a specific type of
expression -- a ternary operator testing an integer variable with the same
variable also used as the resulting index into a character array. The
following code fragment will crash gcc-2.2.2 with a fatal signal 11
internal error on the following types of machines:
Digital DECstations running Ultrix 4.2A
IBM Risc System/6000s running AIX 3.1 and 3.2.
Sun Sparcstations running SunOS 4.1.2
int main()
{
unsigned char this[64];
unsigned char other;
unsigned int index;
other = this[index < 64 ? index : 0];
exit(0);
}
If either use of index is changed to another variable, the program will
compile without incident. Also, if index is changed to a character type,
the program will compile.
Appended is a verbose compilation for an AIX system. I would
appreciate a patch for gcc to fix this problem.
Thanks, David
% gcc -v -c foobar.c
Reading specs from /contrib/lib/gcc-lib/rs6000/2.2/specs
gcc version 2.2
/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
GNU CPP version 2.2
/contrib/lib/gcc-lib/rs6000/2.2/cc1 /tmp/ccW8cCrx.i -quiet -dumpbase foobar.c -version -o /tmp/ccW8cCrx.s
GNU C version 2.2.2 compiled by GNU C version 2.2.
gcc: Internal compiler error: program cc1 got fatal signal 11
===============================================================================
David Edelsohn T.J. Watson Research Center
c$dje@watson.ibm.com P.O. Box 218
+1 914 945 3011 (Tieline 862) Yorktown Heights, NY 10598
"If G-D had wanted us to vote, he would have given us candidates" -- Jay Leno
Technical Details
Message-ID:
<9208271739.AA36908@tweetie.watson.ibm.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!watson.ibm.com!c$djeShow Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!watson.ibm.com!c$dje From: c$dje@watson.ibm.com (David Edelsohn) Subject: gcc-2.2.2 crash -- int ternary operator indexing character array Message-ID: <9208271739.AA36908@tweetie.watson.ibm.com> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Thu, 27 Aug 1992 17:39:50 GMT Approved: bug-gcc@prep.ai.mit.edu Lines: 49