diff options
author | Erick Ochoa <erick.ochoa@theobroma-systems.com> | 2020-04-24 15:15:23 +0200 |
---|---|---|
committer | Erick Ochoa <erick.ochoa@theobroma-systems.com> | 2020-04-28 23:35:54 +0200 |
commit | 0480b87bb99d7ab9aa5b8715fdf4164bbb4cbddf (patch) | |
tree | b625466b2061a21128ffb643a24d0793b1499941 | |
parent | c9b8c68e8f295da1f0ebd209ca22c62df4e4f75d (diff) |
Fixes nasty infinite loop bug
-rw-r--r-- | gcc/ipa-str-reorg-dead-field-eliminate.c | 3 |
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; } |