[gnu.gcc.bug] Bug in tm-mips.h, gcc 1.36

grunwald@foobar.colorado.edu (Dirk Grunwald) (10/17/89)

configuration: config.gcc decstation, version 1.36 with a couple of patches
symptom: can't allocate large stack frames
repeat-by:
  try to compile:
	foo()
	{
	   int x[100000];
	   bar(x);
	}

fix: apply following patch to tm-mips.h & recompile final.o.  I
defined ASM_TMP_REG as register #1, corresponding to the temporary
register ($at) used by the assembler to construct 32 bit literals.

*** /tmp/,RCSt1a00878	Mon Oct 16 15:32:49 1989
--- tm-mips.h	Mon Oct 16 15:29:59 1989
***************
*** 396,401 ****
--- 396,404 ----
  /* Base register for access to local variables of the function.  */
  #define FRAME_POINTER_REGNUM 30
  
+ /* Assembler temporary register */
+ #define ASM_TMP_REGNUM 1
+ 
  /* Value should be nonzero if functions must have frame pointers.
     Zero means the frame pointer need not be set up (and parms
     may be accessed via the stack pointer) in functions that seem suitable.
***************
*** 956,968 ****
  		 push_loc, fp_str);					\
  	push_loc += 8;							\
        }									\
!   if (frame_pointer_needed)						\
!     fprintf (FILE, "\taddiu\t%s,%s,%d\t#Establish FramePTR\n",		\
! 	     (TARGET_NAME_REGS ? reg_names[FRAME_POINTER_REGNUM]	\
! 	      : reg_numchar[FRAME_POINTER_REGNUM]),			\
! 	     (TARGET_NAME_REGS ? reg_names[29] : reg_numchar[29]),	\
! 	     tsize);							\
!   fprintf (FILE," #END PROLOGUE\n");					\
  }
  
  /* Output assembler code to FILE to increment profiler label # LABELNO
--- 959,986 ----
  		 push_loc, fp_str);					\
  	push_loc += 8;							\
        }									\
!   if (frame_pointer_needed) {						\
!       if ( CONST_OK_FOR_LETTER_P(tsize, 'I') ) {			\
! 	  fprintf (FILE, "\taddiu\t%s,%s,%d\t#Establish FramePTR\n",	\
! 		   (TARGET_NAME_REGS ? reg_names[FRAME_POINTER_REGNUM]	\
! 		    : reg_numchar[FRAME_POINTER_REGNUM]),		\
! 		   (TARGET_NAME_REGS ? reg_names[29] : reg_numchar[29]),\
! 		   tsize);						\
!       } else {								\
! 	  fprintf (FILE, "\t.set noat");				\
! 	  fprintf (FILE, "\tlui\t %s,0x%x\n",				\
! 		   reg_numchar[ ASM_TMP_REGNUM ], tsize & 0x0000ffff);	\
! 	  fprintf (FILE, "\tori\t %s,0x%x\n",				\
! 		   reg_numchar[ ASM_TMP_REGNUM ], (tsize >> 16) & 0x0000ffff);\
! 	  fprintf (FILE, "\taddu\t%s,%s,%s\t#Establish FramePTR\n",	\
! 		   (TARGET_NAME_REGS ? reg_names[FRAME_POINTER_REGNUM]	\
! 		    : reg_numchar[FRAME_POINTER_REGNUM]),		\
! 		   (TARGET_NAME_REGS ? reg_names[29] : reg_numchar[29]),\
! 		   reg_numchar[ ASM_TMP_REGNUM ]);			\
! 	  fprintf (FILE, "\t.set at");					\
!       }									\
!   }									\
!    fprintf (FILE," #END PROLOGUE\n");					\
  }
  
  /* Output assembler code to FILE to increment profiler label # LABELNO