diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-06-20 19:43:29 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-06-20 19:43:29 +0000 |
commit | 60f7831206759b96e8b71ee46a8d5bf84f0a6f85 (patch) | |
tree | d9d386ac3cb54b91d77d0cb3b8e7a281d3b33928 | |
parent | 6e9c5c48a7bf5c74148f7f7b7d26570d9e09435d (diff) | |
download | gcc-60f7831206759b96e8b71ee46a8d5bf84f0a6f85.tar.gz |
* ira-costs.c (find_costs_and_classes): Initialize cost_classes later
to make sure not to dereference a NULL cost_classes_ptr pointer.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@249426 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ira-costs.c | 4 |
2 files changed, 8 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8f1bb3d35fa..200dbe41fd6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2017-06-20 Jakub Jelinek <jakub@redhat.com> + + * ira-costs.c (find_costs_and_classes): Initialize cost_classes later + to make sure not to dereference a NULL cost_classes_ptr pointer. + 2017-06-20 Carl Love <cel@us.ibm.com> * config/rs6000/rs6000-c.c (altivec_overloaded_builtins): Add diff --git a/gcc/ira-costs.c b/gcc/ira-costs.c index 9cf01194225..2cd102a0810 100644 --- a/gcc/ira-costs.c +++ b/gcc/ira-costs.c @@ -1744,7 +1744,7 @@ find_costs_and_classes (FILE *dump_file) int best_cost, allocno_cost; enum reg_class best, alt_class; cost_classes_t cost_classes_ptr = regno_cost_classes[i]; - enum reg_class *cost_classes = cost_classes_ptr->classes; + enum reg_class *cost_classes; int *i_costs = temp_costs->cost; int i_mem_cost; int equiv_savings = regno_equiv_gains[i]; @@ -1755,6 +1755,7 @@ find_costs_and_classes (FILE *dump_file) continue; memcpy (temp_costs, COSTS (costs, i), struct_costs_size); i_mem_cost = temp_costs->mem_cost; + cost_classes = cost_classes_ptr->classes; } else { @@ -1762,6 +1763,7 @@ find_costs_and_classes (FILE *dump_file) continue; memset (temp_costs, 0, struct_costs_size); i_mem_cost = 0; + cost_classes = cost_classes_ptr->classes; /* Find cost of all allocnos with the same regno. */ for (a = ira_regno_allocno_map[i]; a != NULL; |