diff options
author | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2010-04-15 20:21:08 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2010-04-15 20:21:08 +0000 |
commit | 1fc24649bc296400468fdd26eb93f144fdafdfbf (patch) | |
tree | df70b088f847795d72172c58ec00218b5b4a4460 /gcc/ada/gcc-interface/utils2.c | |
parent | bafaef55aaaf4f6431b2998cd0cd469c664a0211 (diff) | |
download | gcc-1fc24649bc296400468fdd26eb93f144fdafdfbf.zip gcc-1fc24649bc296400468fdd26eb93f144fdafdfbf.tar.gz gcc-1fc24649bc296400468fdd26eb93f144fdafdfbf.tar.bz2 |
trans.c (gigi): Set DECL_IGNORED_P on EH functions.
* gcc-interface/trans.c (gigi): Set DECL_IGNORED_P on EH functions.
(gnat_to_gnu) <N_Op_Eq>: Restore the value of input_location
before translating the top-level node.
(lvalue_required_p) <N_Function_Call>: Return 1 if !constant.
<N_Object_Declaration>: Likewise.
<N_Assignment_Statement>: Likewise.
<N_Unchecked_Type_Conversion>: Likewise.
(call_to_gnu): Remove kludge.
(gnat_to_gnu) <N_Return_Statement>: When not optimizing, force labels
associated with user returns to be preserved.
(gnat_to_gnu): Add special code to deal with boolean rvalues.
* gcc-interface/utils2.c (compare_arrays): Set input_location on all
comparisons.
(build_unary_op) <ADDR_EXPR>: Call build_fold_addr_expr.
<INDIRECT_REF>: Call build_fold_indirect_ref.
From-SVN: r158388
Diffstat (limited to 'gcc/ada/gcc-interface/utils2.c')
-rw-r--r-- | gcc/ada/gcc-interface/utils2.c | 47 |
1 files changed, 32 insertions, 15 deletions
diff --git a/gcc/ada/gcc-interface/utils2.c b/gcc/ada/gcc-interface/utils2.c index 8257507..3a5b962 100644 --- a/gcc/ada/gcc-interface/utils2.c +++ b/gcc/ada/gcc-interface/utils2.c @@ -303,6 +303,9 @@ compare_arrays (tree result_type, tree a1, tree a2) comparison = build_binary_op (LT_EXPR, result_type, ub, lb); comparison = SUBSTITUTE_PLACEHOLDER_IN_EXPR (comparison, a1); + if (EXPR_P (comparison)) + SET_EXPR_LOCATION (comparison, input_location); + length1 = SUBSTITUTE_PLACEHOLDER_IN_EXPR (length1, a1); length_zero_p = true; @@ -317,6 +320,8 @@ compare_arrays (tree result_type, tree a1, tree a2) { ub1 = TYPE_MAX_VALUE (TYPE_INDEX_TYPE (TYPE_DOMAIN (t1))); lb1 = TYPE_MIN_VALUE (TYPE_INDEX_TYPE (TYPE_DOMAIN (t1))); + /* Note that we know that UB2 and LB2 are constant and hence + cannot contain a PLACEHOLDER_EXPR. */ ub2 = TYPE_MAX_VALUE (TYPE_INDEX_TYPE (TYPE_DOMAIN (t2))); lb2 = TYPE_MIN_VALUE (TYPE_INDEX_TYPE (TYPE_DOMAIN (t2))); nbt = get_base_type (TREE_TYPE (ub1)); @@ -325,14 +330,15 @@ compare_arrays (tree result_type, tree a1, tree a2) = build_binary_op (EQ_EXPR, result_type, build_binary_op (MINUS_EXPR, nbt, ub1, lb1), build_binary_op (MINUS_EXPR, nbt, ub2, lb2)); - - /* Note that we know that UB2 and LB2 are constant and hence - cannot contain a PLACEHOLDER_EXPR. */ - comparison = SUBSTITUTE_PLACEHOLDER_IN_EXPR (comparison, a1); + if (EXPR_P (comparison)) + SET_EXPR_LOCATION (comparison, input_location); + length1 = SUBSTITUTE_PLACEHOLDER_IN_EXPR (length1, a1); this_a1_is_null = build_binary_op (LT_EXPR, result_type, ub1, lb1); + if (EXPR_P (this_a1_is_null)) + SET_EXPR_LOCATION (this_a1_is_null, input_location); this_a2_is_null = convert (result_type, integer_zero_node); } @@ -344,13 +350,20 @@ compare_arrays (tree result_type, tree a1, tree a2) comparison = build_binary_op (EQ_EXPR, result_type, length1, length2); + if (EXPR_P (comparison)) + SET_EXPR_LOCATION (comparison, input_location); this_a1_is_null = build_binary_op (LT_EXPR, result_type, length1, convert (bt, integer_zero_node)); + if (EXPR_P (this_a1_is_null)) + SET_EXPR_LOCATION (this_a1_is_null, input_location); + this_a2_is_null = build_binary_op (LT_EXPR, result_type, length2, convert (bt, integer_zero_node)); + if (EXPR_P (this_a2_is_null)) + SET_EXPR_LOCATION (this_a2_is_null, input_location); } result = build_binary_op (TRUTH_ANDIF_EXPR, result_type, @@ -370,6 +383,7 @@ compare_arrays (tree result_type, tree a1, tree a2) if (!length_zero_p) { tree type = find_common_type (TREE_TYPE (a1), TREE_TYPE (a2)); + tree comparison; if (type) { @@ -377,8 +391,12 @@ compare_arrays (tree result_type, tree a1, tree a2) a2 = convert (type, a2); } - result = build_binary_op (TRUTH_ANDIF_EXPR, result_type, result, - fold_build2 (EQ_EXPR, result_type, a1, a2)); + comparison = fold_build2 (EQ_EXPR, result_type, a1, a2); + if (EXPR_P (comparison)) + SET_EXPR_LOCATION (comparison, input_location); + + result + = build_binary_op (TRUTH_ANDIF_EXPR, result_type, result, comparison); } /* The result is also true if both sizes are zero. */ @@ -1153,21 +1171,17 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand) operand = convert (type, operand); } - if (type != error_mark_node) - operation_type = build_pointer_type (type); - gnat_mark_addressable (operand); - result = fold_build1 (ADDR_EXPR, operation_type, operand); + result = build_fold_addr_expr (operand); } TREE_CONSTANT (result) = staticp (operand) || TREE_CONSTANT (operand); break; case INDIRECT_REF: - /* If we want to refer to an entire unconstrained array, - make up an expression to do so. This will never survive to - the backend. If TYPE is a thin pointer, first convert the - operand to a fat pointer. */ + /* If we want to refer to an unconstrained array, use the appropriate + expression to do so. This will never survive down to the back-end. + But if TYPE is a thin pointer, first convert to a fat pointer. */ if (TYPE_IS_THIN_POINTER_P (type) && TYPE_UNCONSTRAINED_ARRAY (TREE_TYPE (type))) { @@ -1184,12 +1198,15 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand) TREE_READONLY (result) = TYPE_READONLY (TYPE_UNCONSTRAINED_ARRAY (type)); } + + /* If we are dereferencing an ADDR_EXPR, return its operand. */ else if (TREE_CODE (operand) == ADDR_EXPR) result = TREE_OPERAND (operand, 0); + /* Otherwise, build and fold the indirect reference. */ else { - result = fold_build1 (op_code, TREE_TYPE (type), operand); + result = build_fold_indirect_ref (operand); TREE_READONLY (result) = TYPE_READONLY (TREE_TYPE (type)); } |