This is the mail archive of the 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]

Re: Fix find_moveable_pseudos, PR52997

Bernd Schmidt wrote:

> We're creating new pseudos, and while we're resizing some data 
> structures, we aren't doing it for everything.

> @@ -3983,7 +3983,8 @@ find_moveable_pseudos (void)
>    last_moveable_pseudo = max_reg_num ();
> -  fix_reg_equiv_init();
> +  fix_reg_equiv_init ();
> +  resize_reg_info ();
>    regstat_free_n_sets_and_refs ();
>    regstat_free_ri ();
>    regstat_init_n_sets_and_refs ();

This causes a bootstrap failure on s390 when enabling
-fsched-pressure -fsched-pressure-algorithm=model by default
(not sure why this doesn't show up without that change).

The problem is that resize_reg_info only resizes the data
structure, but leaves it uninitialized.  All other uses
of resize_reg_info subsequently fill in that data,
e.g. in ira-costs.c:find_costs_and_classes.

  if (!resize_reg_info () && allocno_p
      && pseudo_classes_defined_p && flag_expensive_optimizations)

But because the structure was now already resized in find_moveable_pseudos,
the next call to resize_reg_info returns false, and thus find_costs_and_classes
assumes the info is actually present, but it is uninitialized, which causes
a crash in the subsequent code

          pref[ALLOCNO_NUM (a)] = reg_preferred_class (ALLOCNO_REGNO (a));
            (ALLOCNO_REGNO (a), pref[ALLOCNO_NUM (a)]);
            = MAX (max_cost_classes_num,
                   regno_cost_classes[ALLOCNO_REGNO (a)]->num);

since reg_preferred_class returns 255 for the new pseudo.


  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE

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