[gnu.gcc.bug] SIGSEGV from eliminate_frame_pointer\reload1.c

wood@DG-RTP.DG.COM (Tom Wood) (01/17/90)

This is potentially a processor specific problem, but as far as I can tell
it isn't.  I have a rather large sample program that when compiled will
generate a SIGSEGV from cc1.  This occurs in GCC 1.35 on the m88100, but
the flaw is also in 1.36.92.  

The loop in eliminate_frame_pointer (in reload1.c) starts off as follows:

  for (insn = first; insn; insn = NEXT_INSN (insn))
    {
      rtx pattern = PATTERN (insn);
      switch (GET_CODE (insn))
	{
	case INSN:

The SIGSEGV occurs when insn is "(barrier A B C)" and it's address is such
that PATTERN(insn) ((char *)insn + 16 on the 88k) is just off the edge
of the data segment.  GET_CODE (insn) is UnKnown, so pattern is never used.
Here's the obvious change for this:

*** reload1.c.orig	Tue Jan 16 14:53:51 1990
--- reload1.c	Tue Jan 16 14:54:55 1990
***************
*** 1088,1097 ****
  
    for (insn = first; insn; insn = NEXT_INSN (insn))
      {
!       rtx pattern = PATTERN (insn);
        switch (GET_CODE (insn))
  	{
  	case INSN:
  	  frame_pointer_address_altered = 0;
  	  alter_frame_pointer_addresses (pattern, depth);
  	  /* Rerecognize insn if changed.  */
--- 1088,1098 ----
  
    for (insn = first; insn; insn = NEXT_INSN (insn))
      {
!       rtx pattern;
        switch (GET_CODE (insn))
  	{
  	case INSN:
+ 	  pattern = PATTERN (insn);
  	  frame_pointer_address_altered = 0;
  	  alter_frame_pointer_addresses (pattern, depth);
  	  /* Rerecognize insn if changed.  */
***************
*** 1129,1134 ****
--- 1130,1136 ----
  	  break;
  
  	case JUMP_INSN:
+ 	  pattern = PATTERN (insn);
  	  frame_pointer_address_altered = 0;
  	  alter_frame_pointer_addresses (pattern, depth);
  	  /* Rerecognize insn if changed.  */
***************
*** 1155,1160 ****
--- 1157,1163 ----
  	  break;
  
  	case CALL_INSN:
+ 	  pattern = PATTERN (insn);
  	  frame_pointer_address_altered = 0;
  	  alter_frame_pointer_addresses (pattern, depth);
  	  /* Rerecognize insn if changed.  */