BOOTSTRAP FAILURE: segementation fault in genattrtab under hpux

John David Anglin dave@hiauly1.hia.nrc.ca
Fri Jan 5 19:10:00 GMT 2001


>   In message <200011150304.WAA20806@hiauly1.hia.nrc.ca>you write:
>   > > On Sun, Nov 12, 2000 at 02:49:29PM -0500, John David Anglin wrote:
>   > > > > > As can be seen, the return pointer rp has been used as a scratch re
>   > gister.
>   > > > > > Its value at the first return is 0.
>   > > > 
>   > > > I added a `(use (reg:SI 2))' to the return insn to work around this pro
>   > blem.
>   > > 
>   > > Hmm, it appears some general cleanup is needed in this area.
>   > > Try the following.
>   > 
>   > Tried it.  The result was the same as with my hack (see below).
>   > 
>   > > > Another problem with regrename?
>   > > 
>   > > Dunno.. does it work with -fno-rename-registers?
>   > 
>   > Still have this problem.  Will try to dig deeper tomorrow.
>   > 
>   > Dave
>   > -- 
>   > J. David Anglin                                  dave.anglin@nrc.ca
>   > National Research Council of Canada              (613) 990-0752 (FAX: 952-6
>   > 605)
>   > 
>   > 2000-11-11  John David Anglin  <dave@hiauly1.hia.nrc.ca>
>   > 
>   > 	* pa.md (return, return_internal): Modify patterns to prevent regrename
>   > 	mucking with the return pointer.
> Thanks.  Installed.  This should prevent problems until Richard's rework of
> the return recognition & support code is done.

Here is another alternative following the line suggested by Richard Earnshaw.
Test build is now in the latter part of stage 2.  The pa.c patch slightly
simplifies the code testing whether the return pointer has been saved.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

2001-01-06  John David Anglin  <dave@hiauly1.hia.nrc.ca>

	* pa.h (hppa_rp_saved, RETURN_POINTER_REGNUM, HARD_REGNO_RENAME_OK):
	New flag and macros to prevent regrename from using rp when it is
	not saved.
	* pa.c (hppa_expand_prologue): Define flag hppa_rp_saved.
	(output_function_prologue,  hppa_expand_epilogue,
	hppa_can_use_return_insn_p): Use new flag.

--- pa.h.orig	Mon Jan  1 18:11:08 2001
+++ pa.h	Fri Jan  5 18:39:25 2001
@@ -496,6 +496,19 @@
    can be restore across function calls.  */
 #define PIC_OFFSET_TABLE_REGNUM_SAVED 4
 
+/* Register in which the return pointer/address is passed to a function.  */
+#define RETURN_POINTER_REGNUM 2
+
+extern int hppa_rp_saved;
+
+/* Define HARD_REGNO_RENAME_OK if restrictions must be placed on the
+   renaming of hard registers.  The return pointer is not saved unless
+   it is live at some point or the profile flag is set.  Don't allow
+   regrename to use it for renaming unless it has been saved.  */
+
+#define HARD_REGNO_RENAME_OK(FROM, TO)	\
+  (hppa_rp_saved || ((TO) != RETURN_POINTER_REGNUM))
+
 #define DEFAULT_PCC_STRUCT_RETURN 0
 
 /* SOM ABI says that objects larger than 64 bits are returned in memory.
--- pa.c.orig	Tue Dec 19 13:19:56 2000
+++ pa.c	Fri Jan  5 17:44:39 2001
@@ -81,6 +81,9 @@
    registers which were saved by the current function's prologue.  */
 static int gr_saved, fr_saved;
 
+/* Return pointer saved flag.  */
+int hppa_rp_saved;
+
 static rtx find_addr_reg PARAMS ((rtx));
 
 /* Keep track of the number of bytes we have output in the CODE subspaces
@@ -2868,7 +2871,7 @@
      to output the assembler directives which denote the start
      of a function.  */
   fprintf (file, "\t.CALLINFO FRAME=%d", actual_fsize);
-  if (regs_ever_live[2] || profile_flag)
+  if (hppa_rp_saved)
     fputs (",CALLS,SAVE_RP", file);
   else
     fputs (",NO_CALLS", file);
@@ -2948,10 +2951,11 @@
   /* Save RP first.  The calling conventions manual states RP will
      always be stored into the caller's frame at sp-20 or sp - 16
      depending on which ABI is in use.  */
-  if ((regs_ever_live[2] || profile_flag) && TARGET_64BIT)
+  hppa_rp_saved = (regs_ever_live[2] || profile_flag);
+  if (hppa_rp_saved && TARGET_64BIT)
     store_reg (2, -16, STACK_POINTER_REGNUM);
 
-  if ((regs_ever_live[2] || profile_flag) && ! TARGET_64BIT)
+  if (hppa_rp_saved && ! TARGET_64BIT)
     store_reg (2, -20, STACK_POINTER_REGNUM);
 
   /* Allocate the local frame and set up the frame pointer if needed.  */
@@ -3220,17 +3224,17 @@
       && (regs_ever_live [2] || profile_flag))
     load_reg (2, -20, FRAME_POINTER_REGNUM);
   else if (TARGET_64BIT && frame_pointer_needed
-	   && (regs_ever_live[2] || profile_flag))
+	   && hppa_rp_saved)
     load_reg (2, -16, FRAME_POINTER_REGNUM);
   else if (TARGET_64BIT
 	   && ! frame_pointer_needed
-	   && (regs_ever_live[2] || profile_flag)
+	   && hppa_rp_saved
 	   && VAL_14_BITS_P (actual_fsize + 20))
     load_reg (2, - (actual_fsize + 16), STACK_POINTER_REGNUM);
   /* No frame pointer, and stack is smaller than 8k.  */
   else if (! frame_pointer_needed
 	   && VAL_14_BITS_P (actual_fsize + 20)
-	   && (regs_ever_live[2] || profile_flag))
+	   && hppa_rp_saved)
     load_reg (2, - (actual_fsize + 20), STACK_POINTER_REGNUM);
 
   /* General register restores.  */
@@ -3300,7 +3304,7 @@
   if (! frame_pointer_needed
       && ! VAL_14_BITS_P (actual_fsize + 20)
       && ! TARGET_64BIT
-      && (regs_ever_live[2] || profile_flag))
+      && hppa_rp_saved)
     {
       set_reg_plus_d (STACK_POINTER_REGNUM,
 		      STACK_POINTER_REGNUM,
@@ -3317,7 +3321,7 @@
   else if (! frame_pointer_needed
 	   && ! VAL_14_BITS_P (actual_fsize + 20)
 	   && TARGET_64BIT
-	   && (regs_ever_live[2] || profile_flag))
+	   && hppa_rp_saved)
     {
       set_reg_plus_d (STACK_POINTER_REGNUM,
 		      STACK_POINTER_REGNUM,
@@ -3465,8 +3469,7 @@
 {
   return (reload_completed
 	  && (compute_frame_size (get_frame_size (), 0) ? 0 : 1)
-	  && ! profile_flag
-	  && ! regs_ever_live[2]
+	  && ! hppa_rp_saved
 	  && ! frame_pointer_needed);
 }
 


More information about the Gcc-bugs mailing list