summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErick Ochoa <erick.ochoa@theobroma-systems.com>2020-04-24 15:15:23 +0200
committerErick Ochoa <erick.ochoa@theobroma-systems.com>2020-05-14 14:45:52 +0200
commitaa6fcc71a746535ce19dabe8773931688e7ea87e (patch)
tree6f1291a5b54401be8dfb8b22cd63dd8423319cc5
parent0c5ae46660f9c035ca67de5b1d9c1d45d5da7211 (diff)
Fixes nasty infinite loop bug
-rw-r--r--gcc/ipa-str-reorg-dead-field-eliminate.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/ipa-str-reorg-dead-field-eliminate.c b/gcc/ipa-str-reorg-dead-field-eliminate.c
index 59b82fd2b3f..27c67245b81 100644
--- a/gcc/ipa-str-reorg-dead-field-eliminate.c
+++ b/gcc/ipa-str-reorg-dead-field-eliminate.c
@@ -1936,11 +1936,12 @@ rewrite_pointer_plus_def_rhs_integer_constant (tree pointer,
tree old_type_size = TYPE_SIZE_UNIT (old_base_type);
int old_struct_size = tree_to_shwi (old_type_size);
+ int modulo = old_offset % old_struct_size;
test_log ("old_struct_size = %d", 0, old_struct_size);
tree integer_constant_type = TREE_TYPE (integer_constant);
- int new_offset = old_offset / old_struct_size * new_struct_size;
+ int new_offset = old_offset / old_struct_size * new_struct_size + modulo;
tree new_constant = build_int_cst (integer_constant_type, new_offset);
return new_constant;
}