From 6686e0bc1e8b83aed19f383b527bc67b5ba53480 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Wed, 26 Mar 2014 06:46:27 +0000 Subject: [PATCH] re PR other/59545 (Signed integer overflow issues) PR other/59545 * ira-color.c (update_conflict_hard_regno_costs): Perform the multiplication in unsigned type. From-SVN: r208834 --- gcc/ChangeLog | 6 ++++++ gcc/ira-color.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index dc4ebfe38e6a..ee0df1c23e9b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2014-03-26 Marek Polacek + + PR other/59545 + * ira-color.c (update_conflict_hard_regno_costs): Perform the + multiplication in unsigned type. + 2014-03-26 Chung-Ju Wu * doc/install.texi: Document nds32le-*-elf and nds32be-*-elf. diff --git a/gcc/ira-color.c b/gcc/ira-color.c index c20aaf72dc60..1f4c96e9a897 100644 --- a/gcc/ira-color.c +++ b/gcc/ira-color.c @@ -1505,7 +1505,7 @@ update_conflict_hard_regno_costs (int *costs, enum reg_class aclass, index = ira_class_hard_reg_index[aclass][hard_regno]; if (index < 0) continue; - cost = conflict_costs [i] * mult / div; + cost = (int) ((unsigned) conflict_costs [i] * mult) / div; if (cost == 0) continue; cont_p = true; -- 2.47.3