This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug bootstrap/14671] [3.3/3.4 regression] caller-save.c:491: internal compiler error: Segmentation fault


------- Additional Comments From rguenth at tat dot physik dot uni-tuebingen dot de  2004-05-28 07:40 -------
Subject: Re:  [3.3/3.4 regression] caller-save.c:491:
 internal compiler error: Segmentation fault

On Fri, 28 May 2004, dave at hiauly1 dot hia dot nrc dot ca wrote:

>
> ------- Additional Comments From dave at hiauly1 dot hia dot nrc dot ca  2004-05-28 01:34 -------
> Subject: Re:  [3.3/3.4 regression] caller-save.c:491: int
>
> > | This appears to be because alias_invariant was not GC allocated.  I
> > | think the patch that I posted earlier today will fix this.  It's basically
> > | the same as that applied to the trunk except that in 3.3 the arrays are
> > | over allocated to allow for expansion during loop_optimize.
> >
> > Thanks for the additional information.  Please could you give me a
> > link to the patch that you proposed for 3.3.x?  Thanks.
>
> Here is the patch that I propose.  It uses ggc_alloc_cleared because
> the multiplication is already done in init_alias_analysis.  I have
> added the "rtx *" cast for K&R compatibility.
>
> I have built the testcase provided with PR15660 and the current version
> of the pooma-2.4.0 with -O2 -funroll-loops.  However, the triggering
> of collection probably depends on the amount of memory in the test
> machine.  So, Richard should test the patch and see if it resolves
> his PR.
>
> I've done a complete bootstrap with no regressions on hppa-unknown-linux-gnu.
> A full build of all languages except treelang has just completed on
> i686-pc-linux-gnu.  I will start a check.
>
> A similar fix is needed for 3.4.
>
> Dave
> --
> J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
> National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)
>
> 2004-05-27  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
>
> 	PR bootstrap/14671
> 	* alias.c (init_alias_analysis): Allocate alias_invariant array with
> 	ggc_alloc_cleared instead of xrealloc.
> 	(end_alias_analysis): Don't free alias_invariant.
>
> Index: alias.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/alias.c,v
> retrieving revision 1.181.2.5
> diff -u -3 -p -r1.181.2.5 alias.c
> --- alias.c	8 May 2004 21:52:42 -0000	1.181.2.5
> +++ alias.c	27 May 2004 21:07:12 -0000
> @@ -2786,10 +2786,8 @@ init_alias_analysis ()
>    reg_seen = (char *) xmalloc (reg_base_value_size);
>    if (! reload_completed && flag_unroll_loops)
>      {
> -      /* ??? Why are we realloc'ing if we're just going to zero it?  */
> -      alias_invariant = (rtx *)xrealloc (alias_invariant,
> -					 reg_base_value_size * sizeof (rtx));
> -      memset ((char *)alias_invariant, 0, reg_base_value_size * sizeof (rtx));
> +      alias_invariant = (rtx *) ggc_alloc_cleared (reg_base_value_size
> +						   * sizeof (rtx));
>        alias_invariant_size = reg_base_value_size;
>      }
>
> @@ -2985,7 +2983,6 @@ end_alias_analysis ()
>    reg_base_value_size = 0;
>    if (alias_invariant)
>      {
> -      free (alias_invariant);
>        alias_invariant = 0;
>        alias_invariant_size = 0;
>      }

Duh, I had the following applied:

--- gcc/alias.c 8 May 2004 21:52:42 -0000       1.181.2.5
+++ gcc/alias.c 28 May 2004 07:32:23 -0000
@@ -2787,10 +2787,8 @@
   if (! reload_completed && flag_unroll_loops)
     {
       /* ??? Why are we realloc'ing if we're just going to zero it?  */
-      alias_invariant = (rtx *)xrealloc (alias_invariant,
-                                        reg_base_value_size * sizeof
(rtx));
-      memset ((char *)alias_invariant, 0, reg_base_value_size * sizeof
(rtx));
-      alias_invariant_size = reg_base_value_size;
+      alias_invariant = ggc_calloc (maxreg, sizeof (rtx));
+      alias_invariant_size = maxreg;
     }

   /* The basic idea is that each pass through this loop will use the
@@ -2985,7 +2983,6 @@
   reg_base_value_size = 0;
   if (alias_invariant)
     {
-      free (alias_invariant);
       alias_invariant = 0;
       alias_invariant_size = 0;
     }

I'll re-check with the patch above.  Unrelated, I have also applied
locally

--- gcc/loop.c  29 Jan 2004 04:42:15 -0000      1.433.2.13
+++ gcc/loop.c  28 May 2004 07:32:24 -0000
@@ -4924,6 +4924,9 @@
                                          gen_move_insn (v->dest_reg,
                                                         v->new_reg));

+         /* We must do this now because we just emitted a new set.  */
+         RTX_UNCHANGING_P (v->dest_reg) = 0;
+
          /* The original insn may have a REG_EQUAL note.  This note is
             now incorrect and may result in invalid substitutions later.
             The original insn is dead, but may be part of a libcall

(PR14671)

and from previous does-this-fix-it iterations

--- gcc/loop.h  17 May 2004 21:05:46 -0000      1.65.2.2
+++ gcc/loop.h  28 May 2004 07:32:25 -0000
@@ -49,9 +49,18 @@
   (INSN_UID (INSN) < max_uid_for_loop ? uid_luid[INSN_UID (INSN)] \
    : (abort (), -1))

-#define REGNO_FIRST_LUID(REGNO) uid_luid[REGNO_FIRST_UID (REGNO)]
-#define REGNO_LAST_LUID(REGNO) uid_luid[REGNO_LAST_UID (REGNO)]
-#define REGNO_LAST_NOTE_LUID(REGNO) uid_luid[REGNO_LAST_NOTE_UID (REGNO)]
+#define REGNO_FIRST_LUID(REGNO)                        \
+  (REGNO_FIRST_UID (REGNO) < max_uid_for_loop  \
+       ? uid_luid[REGNO_FIRST_UID (REGNO)]     \
+       : 0)
+#define REGNO_LAST_LUID(REGNO)                 \
+  (REGNO_LAST_UID (REGNO) < max_uid_for_loop   \
+       ? uid_luid[REGNO_LAST_UID (REGNO)]      \
+       : INT_MAX)
+#define REGNO_LAST_NOTE_LUID(REGNO)                 \
+  (REGNO_LAST_NOTE_UID (REGNO) < max_uid_for_loop   \
+       ? uid_luid[REGNO_LAST_NOTE_UID (REGNO)]      \
+       : INT_MAX)


 /* A "basic induction variable" or biv is a pseudo reg that is set
--- gcc/unroll.c        17 May 2004 21:05:48 -0000      1.184.2.9
+++ gcc/unroll.c        28 May 2004 07:32:25 -0000
@@ -2557,7 +2557,7 @@
       biv_final_value = 0;
       if (unroll_type != UNROLL_COMPLETELY
          && (loop->exit_count || unroll_type == UNROLL_NAIVE)
-         && (REGNO_LAST_LUID (bl->regno) >= INSN_LUID (loop->end)
+         && (REGNO_LAST_NOTE_LUID (bl->regno) >= INSN_LUID (loop->end)
              || ! bl->init_insn
              || INSN_UID (bl->init_insn) >= max_uid_for_loop
              || (REGNO_FIRST_LUID (bl->regno)
@@ -2754,7 +2754,7 @@
                      || (REGNO_FIRST_UID (REGNO (v->dest_reg))
                          != INSN_UID (XEXP (tem, 0)))))
              /* Line above always fails if INSN was moved by loop opt.
*/
-             || (REGNO_LAST_LUID (REGNO (v->dest_reg))
+             || (REGNO_LAST_NOTE_LUID (REGNO (v->dest_reg))
                  >= INSN_LUID (loop->end)))
          && ! (final_value = v->final_value))
        continue;



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14671


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]