summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErick Ochoa <erick.ochoa@theobroma-systems.com>2020-02-21 21:35:59 +0100
committerErick Ochoa <erick.ochoa@theobroma-systems.com>2020-04-28 23:35:44 +0200
commit7173b28b3d0616a17f27469c23837e3b86ee29ed (patch)
treecc39afe52ba11ea4385242a0c15e7f60ca10769e
parent192c48af7d69be230c0998c12c31043632d2bcf8 (diff)
Fixes warnings
-rw-r--r--gcc/ipa-str-reorg-dead-field-eliminate.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/gcc/ipa-str-reorg-dead-field-eliminate.c b/gcc/ipa-str-reorg-dead-field-eliminate.c
index 309ea884c0a..a93b84e9a5f 100644
--- a/gcc/ipa-str-reorg-dead-field-eliminate.c
+++ b/gcc/ipa-str-reorg-dead-field-eliminate.c
@@ -86,12 +86,18 @@ log_expr_prologue (const int indent, const char *debug_str, tree expr)
test_log ("< type = %s>", indent, get_type_name (type));
}
+static tree
+const_to_tree (const_tree ctree)
+{
+ return (tree) ctree;
+}
+
static void
substitute_type (tree expr, const_tree new_type)
{
gcc_assert(expr);
gcc_assert(new_type);
- TREE_TYPE(expr) = (tree) new_type;
+ TREE_TYPE(expr) = const_to_tree(new_type);
}
static void
@@ -1582,7 +1588,7 @@ rewrite_component_ref_def (tree expr,
bool retval = rewrite_expr (_struct, type_map, indent);
tree new_type
- = new_struct_type_ptr ? (tree) *new_struct_type_ptr : _struct_type;
+ = new_struct_type_ptr ? const_to_tree(*new_struct_type_ptr) : _struct_type;
tree field_decl = TREE_OPERAND (expr, 1);
const char *field_name = get_field_name (field_decl);
if (strcmp (field_name, "anonymous") == 0)
@@ -1598,7 +1604,7 @@ rewrite_component_ref_def (tree expr,
// TODO: FIXME: In order to remove this assertion
// you need to use clones.
gcc_assert (in_lto_p && !flag_ltrans && !flag_wpa);
- TREE_OPERAND (expr, 1) = (tree) new_field;
+ TREE_OPERAND (expr, 1) = const_to_tree(new_field);
int offset = get_field_offset (new_field);
test_log ("rewrite,field_offset,%s,%d", indent, field_name, offset);
gcc_assert (TREE_OPERAND (expr, 2) == NULL);
@@ -1661,7 +1667,7 @@ rewrite_mem_ref_def (tree expr, hash_map<const_tree, const_tree> &type_map,
int old_type_size_int = tree_to_shwi (old_struct_size);
test_log ("old_type = %s", 0, get_type_name (type));
test_log ("old_type_size = %ld", 0, tree_to_shwi (old_struct_size));
- tree new_struct_size = TYPE_SIZE_UNIT ((tree) *new_type_ptr);
+ tree new_struct_size = TYPE_SIZE_UNIT (const_to_tree(*new_type_ptr));
int new_type_size_int = tree_to_shwi (new_struct_size);
int multiple = old_offset / old_type_size_int;
int offset = multiple * new_type_size_int;