diff options
Diffstat (limited to 'gcc/ada/gcc-interface')
-rw-r--r-- | gcc/ada/gcc-interface/decl.c | 1 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/trans.c | 24 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/utils2.c | 22 |
3 files changed, 34 insertions, 13 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 1719d1c..3dbb3b5 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -1942,6 +1942,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) gnu_template_reference = build_unary_op (INDIRECT_REF, gnu_template_type, tem); TREE_READONLY (gnu_template_reference) = 1; + TREE_THIS_NOTRAP (gnu_template_reference) = 1; /* Now create the GCC type for each index and add the fields for that index to the template. */ diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index 9d021b8..c2068c0 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -978,14 +978,22 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p) if (TREE_CODE (gnu_result) == PARM_DECL && DECL_BY_DOUBLE_REF_P (gnu_result)) - gnu_result = build_unary_op (INDIRECT_REF, NULL_TREE, gnu_result); + { + gnu_result = build_unary_op (INDIRECT_REF, NULL_TREE, gnu_result); + if (TREE_CODE (gnu_result) == INDIRECT_REF) + TREE_THIS_NOTRAP (gnu_result) = 1; + } if (TREE_CODE (gnu_result) == PARM_DECL && DECL_BY_COMPONENT_PTR_P (gnu_result)) - gnu_result - = build_unary_op (INDIRECT_REF, NULL_TREE, - convert (build_pointer_type (gnu_result_type), - gnu_result)); + { + gnu_result + = build_unary_op (INDIRECT_REF, NULL_TREE, + convert (build_pointer_type (gnu_result_type), + gnu_result)); + if (TREE_CODE (gnu_result) == INDIRECT_REF) + TREE_THIS_NOTRAP (gnu_result) = 1; + } /* If it's a renaming pointer and we are at the right binding level, we can reference the renamed object directly, since the renamed @@ -1003,7 +1011,11 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p) DECL_INITIAL (gnu_result)); else - gnu_result = build_unary_op (INDIRECT_REF, NULL_TREE, gnu_result); + { + gnu_result = build_unary_op (INDIRECT_REF, NULL_TREE, gnu_result); + if (TREE_CODE (gnu_result) == INDIRECT_REF) + TREE_THIS_NOTRAP (gnu_result) = 1; + } if (read_only) TREE_READONLY (gnu_result) = 1; diff --git a/gcc/ada/gcc-interface/utils2.c b/gcc/ada/gcc-interface/utils2.c index 8d5bbef..0748b32 100644 --- a/gcc/ada/gcc-interface/utils2.c +++ b/gcc/ada/gcc-interface/utils2.c @@ -960,14 +960,19 @@ build_binary_op (enum tree_code op_code, tree result_type, result = fold_build2 (op_code, operation_type, left_operand, right_operand); - TREE_SIDE_EFFECTS (result) |= has_side_effects; - TREE_CONSTANT (result) - |= (TREE_CONSTANT (left_operand) & TREE_CONSTANT (right_operand) - && op_code != ARRAY_REF && op_code != ARRAY_RANGE_REF); + if (TREE_CONSTANT (result)) + ; + else if (op_code == ARRAY_REF || op_code == ARRAY_RANGE_REF) + { + TREE_THIS_NOTRAP (result) = 1; + if (TYPE_VOLATILE (operation_type)) + TREE_THIS_VOLATILE (result) = 1; + } + else + TREE_CONSTANT (result) + |= (TREE_CONSTANT (left_operand) && TREE_CONSTANT (right_operand)); - if ((op_code == ARRAY_REF || op_code == ARRAY_RANGE_REF) - && TYPE_VOLATILE (operation_type)) - TREE_THIS_VOLATILE (result) = 1; + TREE_SIDE_EFFECTS (result) |= has_side_effects; /* If we are working with modular types, perform the MOD operation if something above hasn't eliminated the need for it. */ @@ -2347,6 +2352,9 @@ gnat_stabilize_reference_1 (tree e, bool force) TREE_SIDE_EFFECTS (result) |= TREE_SIDE_EFFECTS (e); TREE_THIS_VOLATILE (result) = TREE_THIS_VOLATILE (e); + if (code == INDIRECT_REF || code == ARRAY_REF || code == ARRAY_RANGE_REF) + TREE_THIS_NOTRAP (result) = TREE_THIS_NOTRAP (e); + return result; } |