On 12/26/2013 04:41 AM, Senthil Kumar Selvaraj wrote:
> Hi,
>
>   gcc.c-torture/compile/pr34856.c and a couple of other tests segfault 
>   for the AVR target. Looking at the code, I found that the
>   x_ira_register_move_cost array[TImode] is NULL, while the code goes on
>   to dereference it (ira_register_move_cost
>   [ALLOCNO_MODE (a)][best][aclass] at line 1832).
>
>   I looked at the code that populates the array, and found that it does
>   explicitly allow the array to have NULL entries for certain modes,
>   atleast during initialization.
>
>   I'm not really sure how this should be fixed - is NULL valid or is the
>   AVR target violating some invariant?
>
The following patch fixes the problem.

Committed as rev. 206606.

2014-01-14  Vladimir Makarov  <vmaka...@redhat.com>

        * ira-costs.c (find_costs_and_classes): Add missed
        ira_init_register_move_cost_if_necessary.


Index: ira-costs.c
===================================================================
--- ira-costs.c (revision 206579)
+++ ira-costs.c (working copy)
@@ -1827,6 +1827,7 @@ find_costs_and_classes (FILE *dump_file)
                  int ind = cost_classes_ptr->index[aclass];
 
                  ira_assert (ind >= 0);
+                 ira_init_register_move_cost_if_necessary (ALLOCNO_MODE (a));
                  ira_add_allocno_pref (a, ira_class_hard_regs[best][0],
                                        (a_costs[ind] - ALLOCNO_CLASS_COST (a))
                                        / (ira_register_move_cost

Reply via email to