re PR c/40435 (Revision 148442 caused many regressions on trunk)

2009-07-17  Aldy Hernandez  <aldyh@redhat.com>
	    Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR 40435 
	* tree-complex.c, tree-loop-distribution.c,
	tree.c, tree.h, builtins.c, fold-const.c, omp-low.c,
	cgraphunit.c, tree-ssa-ccp.c, tree-ssa-dom.c,
	gimple-low.c, expr.c, tree-ssa-ifcombine.c, c-decl.c,
	stor-layout.c, tree-if-conv.c, c-typeck.c,
	gimplify.c, calls.c, tree-sra.c, tree-mudflap.c,
	tree-ssa-copy.c, tree-ssa-forwprop.c, c-convert.c, c-omp.c,
	varasm.c, tree-inline.c, c-common.c,
	c-common.h, gimple.c, tree-switch-conversion.c, gimple.h,
	tree-cfg.c, c-parser.c, convert.c: Add location
	argument to fold_{unary,binary,ternary}, fold_build[123],
	build_call_expr, build_size_arg, build_fold_addr_expr,
	build_call_array, non_lvalue, size_diffop,
	fold_build1_initializer, fold_build2_initializer,
	fold_build3_initializer, fold_build_call_array,
	fold_build_call_array_initializer, fold_single_bit_test,
	omit_one_operand, omit_two_operands, invert_truthvalue,
	fold_truth_not_expr, build_fold_indirect_ref, fold_indirect_ref,
	combine_comparisons, fold_builtin_*, fold_call_expr,
	build_range_check, maybe_fold_offset_to_address, round_up,
	round_down.
objc/
	* objc-act.c: Add location argument to all calls to
	build_fold_addr_expr.
testsuite/
	* gcc.dg/pr36902.c: Add column info.
	* g++.dg/gcov/gcov-2.C: Change count for definition.
cp/
	* typeck.c, init.c, class.c, method.c, rtti.c, except.c, error.c,
	tree.c, cp-gimplify.c, cxx-pretty-print.c, pt.c, semantics.c,
	call.c, cvt.c, mangle.c: Add location argument to
	fold_{unary,binary,ternary}, fold_build[123], build_call_expr,
	build_size_arg, build_fold_addr_expr, build_call_array,
	non_lvalue, size_diffop, fold_build1_initializer,
	fold_build2_initializer, fold_build3_initializer,
	fold_build_call_array, fold_build_call_array_initializer,
	fold_single_bit_test, omit_one_operand, omit_two_operands,
	invert_truthvalue, fold_truth_not_expr, build_fold_indirect_ref,
	fold_indirect_ref, combine_comparisons, fold_builtin_*,
	fold_call_expr, build_range_check, maybe_fold_offset_to_address,
	round_up, round_down.
fortran/
	* trans-expr.c, trans-array.c, trans-openmp.c, trans-stmt.c,
	trans.c, trans-io.c, trans-decl.c, trans-intrinsic.c: Add location
	argument to fold_{unary,binary,ternary}, fold_build[123],
	build_call_expr, build_size_arg, build_fold_addr_expr,
	build_call_array, non_lvalue, size_diffop,
	fold_build1_initializer, fold_build2_initializer,
	fold_build3_initializer, fold_build_call_array,
	fold_build_call_array_initializer, fold_single_bit_test,
	omit_one_operand, omit_two_operands, invert_truthvalue,
	fold_truth_not_expr, build_fold_indirect_ref, fold_indirect_ref,
	combine_comparisons, fold_builtin_*, fold_call_expr,
	build_range_check, maybe_fold_offset_to_address, round_up,
	round_down.

Co-Authored-By: Manuel López-Ibáñez <manu@gcc.gnu.org>

From-SVN: r149722
This commit is contained in:
Aldy Hernandez 2009-07-16 22:29:52 +00:00 committed by Manuel López-Ibáñez
parent c32097d8b4
commit db3927fb49
66 changed files with 3545 additions and 2604 deletions

View File

@ -1,3 +1,27 @@
2009-07-17 Aldy Hernandez <aldyh@redhat.com>
Manuel López-Ibáñez <manu@gcc.gnu.org>
PR 40435
* tree-complex.c, tree-loop-distribution.c, tree.c, tree.h,
builtins.c, fold-const.c, omp-low.c, cgraphunit.c, tree-ssa-ccp.c,
tree-ssa-dom.c, gimple-low.c, expr.c, tree-ssa-ifcombine.c,
c-decl.c, stor-layout.c, tree-if-conv.c, c-typeck.c, gimplify.c,
calls.c, tree-sra.c, tree-mudflap.c, tree-ssa-copy.c,
tree-ssa-forwprop.c, c-convert.c, c-omp.c, varasm.c,
tree-inline.c, c-common.c, c-common.h, gimple.c,
tree-switch-conversion.c, gimple.h, tree-cfg.c, c-parser.c,
convert.c: Add location argument to fold_{unary,binary,ternary},
fold_build[123], build_call_expr, build_size_arg,
build_fold_addr_expr, build_call_array, non_lvalue, size_diffop,
fold_build1_initializer, fold_build2_initializer,
fold_build3_initializer, fold_build_call_array,
fold_build_call_array_initializer, fold_single_bit_test,
omit_one_operand, omit_two_operands, invert_truthvalue,
fold_truth_not_expr, build_fold_indirect_ref, fold_indirect_ref,
combine_comparisons, fold_builtin_*, fold_call_expr,
build_range_check, maybe_fold_offset_to_address, round_up,
round_down.
2009-07-16 Jason Merrill <jason@redhat.com> 2009-07-16 Jason Merrill <jason@redhat.com>
PR libstdc++/37907 PR libstdc++/37907

File diff suppressed because it is too large Load Diff

View File

@ -1086,6 +1086,7 @@ c_fully_fold (tree expr, bool in_init, bool *maybe_const)
tree eptype = NULL_TREE; tree eptype = NULL_TREE;
bool dummy = true; bool dummy = true;
bool maybe_const_itself = true; bool maybe_const_itself = true;
location_t loc = EXPR_LOCATION (expr);
/* This function is not relevant to C++ because C++ folds while /* This function is not relevant to C++ because C++ folds while
parsing, and may need changes to be correct for C++ when C++ parsing, and may need changes to be correct for C++ when C++
@ -1103,7 +1104,7 @@ c_fully_fold (tree expr, bool in_init, bool *maybe_const)
ret = c_fully_fold_internal (expr, in_init, maybe_const, ret = c_fully_fold_internal (expr, in_init, maybe_const,
&maybe_const_itself); &maybe_const_itself);
if (eptype) if (eptype)
ret = fold_convert (eptype, ret); ret = fold_convert_loc (loc, eptype, ret);
*maybe_const &= maybe_const_itself; *maybe_const &= maybe_const_itself;
return ret; return ret;
} }
@ -1300,8 +1301,8 @@ c_fully_fold_internal (tree expr, bool in_init, bool *maybe_const_operands,
op1 = decl_constant_value_for_optimization (op1); op1 = decl_constant_value_for_optimization (op1);
if (op0 != orig_op0 || op1 != orig_op1 || in_init) if (op0 != orig_op0 || op1 != orig_op1 || in_init)
ret = in_init ret = in_init
? fold_build2_initializer (code, TREE_TYPE (expr), op0, op1) ? fold_build2_initializer_loc (loc, code, TREE_TYPE (expr), op0, op1)
: fold_build2 (code, TREE_TYPE (expr), op0, op1); : fold_build2_loc (loc, code, TREE_TYPE (expr), op0, op1);
else else
ret = fold (expr); ret = fold (expr);
goto out; goto out;
@ -1326,8 +1327,8 @@ c_fully_fold_internal (tree expr, bool in_init, bool *maybe_const_operands,
op0 = decl_constant_value_for_optimization (op0); op0 = decl_constant_value_for_optimization (op0);
if (op0 != orig_op0 || in_init) if (op0 != orig_op0 || in_init)
ret = in_init ret = in_init
? fold_build1_initializer (code, TREE_TYPE (expr), op0) ? fold_build1_initializer_loc (loc, code, TREE_TYPE (expr), op0)
: fold_build1 (code, TREE_TYPE (expr), op0); : fold_build1_loc (loc, code, TREE_TYPE (expr), op0);
else else
ret = fold (expr); ret = fold (expr);
if (code == INDIRECT_REF if (code == INDIRECT_REF
@ -1350,8 +1351,8 @@ c_fully_fold_internal (tree expr, bool in_init, bool *maybe_const_operands,
op1 = c_fully_fold_internal (op1, in_init, &op1_const, &op1_const_self); op1 = c_fully_fold_internal (op1, in_init, &op1_const, &op1_const_self);
if (op0 != orig_op0 || op1 != orig_op1 || in_init) if (op0 != orig_op0 || op1 != orig_op1 || in_init)
ret = in_init ret = in_init
? fold_build2_initializer (code, TREE_TYPE (expr), op0, op1) ? fold_build2_initializer_loc (loc, code, TREE_TYPE (expr), op0, op1)
: fold_build2 (code, TREE_TYPE (expr), op0, op1); : fold_build2_loc (loc, code, TREE_TYPE (expr), op0, op1);
else else
ret = fold (expr); ret = fold (expr);
*maybe_const_operands &= op0_const; *maybe_const_operands &= op0_const;
@ -1379,7 +1380,7 @@ c_fully_fold_internal (tree expr, bool in_init, bool *maybe_const_operands,
op1 = c_fully_fold_internal (op1, in_init, &op1_const, &op1_const_self); op1 = c_fully_fold_internal (op1, in_init, &op1_const, &op1_const_self);
op2 = c_fully_fold_internal (op2, in_init, &op2_const, &op2_const_self); op2 = c_fully_fold_internal (op2, in_init, &op2_const, &op2_const_self);
if (op0 != orig_op0 || op1 != orig_op1 || op2 != orig_op2) if (op0 != orig_op0 || op1 != orig_op1 || op2 != orig_op2)
ret = fold_build3 (code, TREE_TYPE (expr), op0, op1, op2); ret = fold_build3_loc (loc, code, TREE_TYPE (expr), op0, op1, op2);
else else
ret = fold (expr); ret = fold (expr);
*maybe_const_operands &= op0_const; *maybe_const_operands &= op0_const;
@ -1620,7 +1621,8 @@ warn_logical_operator (location_t location, enum tree_code code, tree type,
if (lhs && rhs && operand_equal_p (lhs, rhs, 0) if (lhs && rhs && operand_equal_p (lhs, rhs, 0)
&& merge_ranges (&in_p, &low, &high, in0_p, low0, high0, && merge_ranges (&in_p, &low, &high, in0_p, low0, high0,
in1_p, low1, high1) in1_p, low1, high1)
&& 0 != (tem = build_range_check (type, lhs, in_p, low, high))) && 0 != (tem = build_range_check (UNKNOWN_LOCATION,
type, lhs, in_p, low, high)))
{ {
if (TREE_CODE (tem) != INTEGER_CST) if (TREE_CODE (tem) != INTEGER_CST)
return; return;
@ -3658,7 +3660,8 @@ shorten_compare (tree *op0_ptr, tree *op1_ptr, tree *restype_ptr,
of pointer PTROP and integer INTOP. */ of pointer PTROP and integer INTOP. */
tree tree
pointer_int_sum (enum tree_code resultcode, tree ptrop, tree intop) pointer_int_sum (location_t loc, enum tree_code resultcode,
tree ptrop, tree intop)
{ {
tree size_exp, ret; tree size_exp, ret;
@ -3667,19 +3670,19 @@ pointer_int_sum (enum tree_code resultcode, tree ptrop, tree intop)
if (TREE_CODE (TREE_TYPE (result_type)) == VOID_TYPE) if (TREE_CODE (TREE_TYPE (result_type)) == VOID_TYPE)
{ {
pedwarn (input_location, pedantic ? OPT_pedantic : OPT_Wpointer_arith, pedwarn (loc, pedantic ? OPT_pedantic : OPT_Wpointer_arith,
"pointer of type %<void *%> used in arithmetic"); "pointer of type %<void *%> used in arithmetic");
size_exp = integer_one_node; size_exp = integer_one_node;
} }
else if (TREE_CODE (TREE_TYPE (result_type)) == FUNCTION_TYPE) else if (TREE_CODE (TREE_TYPE (result_type)) == FUNCTION_TYPE)
{ {
pedwarn (input_location, pedantic ? OPT_pedantic : OPT_Wpointer_arith, pedwarn (loc, pedantic ? OPT_pedantic : OPT_Wpointer_arith,
"pointer to a function used in arithmetic"); "pointer to a function used in arithmetic");
size_exp = integer_one_node; size_exp = integer_one_node;
} }
else if (TREE_CODE (TREE_TYPE (result_type)) == METHOD_TYPE) else if (TREE_CODE (TREE_TYPE (result_type)) == METHOD_TYPE)
{ {
pedwarn (input_location, pedantic ? OPT_pedantic : OPT_Wpointer_arith, pedwarn (loc, pedantic ? OPT_pedantic : OPT_Wpointer_arith,
"pointer to member function used in arithmetic"); "pointer to member function used in arithmetic");
size_exp = integer_one_node; size_exp = integer_one_node;
} }
@ -3734,15 +3737,15 @@ pointer_int_sum (enum tree_code resultcode, tree ptrop, tree intop)
Do this multiplication as signed, then convert to the appropriate Do this multiplication as signed, then convert to the appropriate
type for the pointer operation. */ type for the pointer operation. */
intop = convert (sizetype, intop = convert (sizetype,
build_binary_op (EXPR_LOCATION (intop), build_binary_op (loc,
MULT_EXPR, intop, MULT_EXPR, intop,
convert (TREE_TYPE (intop), size_exp), 1)); convert (TREE_TYPE (intop), size_exp), 1));
/* Create the sum or difference. */ /* Create the sum or difference. */
if (resultcode == MINUS_EXPR) if (resultcode == MINUS_EXPR)
intop = fold_build1 (NEGATE_EXPR, sizetype, intop); intop = fold_build1_loc (loc, NEGATE_EXPR, sizetype, intop);
ret = fold_build2 (POINTER_PLUS_EXPR, result_type, ptrop, intop); ret = fold_build2_loc (loc, POINTER_PLUS_EXPR, result_type, ptrop, intop);
fold_undefer_and_ignore_overflow_warnings (); fold_undefer_and_ignore_overflow_warnings ();
@ -3925,7 +3928,7 @@ c_common_truthvalue_conversion (location_t location, tree expr)
/* Distribute the conversion into the arms of a COND_EXPR. */ /* Distribute the conversion into the arms of a COND_EXPR. */
if (c_dialect_cxx ()) if (c_dialect_cxx ())
{ {
expr = fold_build3 (COND_EXPR, truthvalue_type_node, expr = fold_build3_loc (location, COND_EXPR, truthvalue_type_node,
TREE_OPERAND (expr, 0), TREE_OPERAND (expr, 0),
c_common_truthvalue_conversion (location, c_common_truthvalue_conversion (location,
TREE_OPERAND (expr, TREE_OPERAND (expr,
@ -4290,9 +4293,9 @@ c_sizeof_or_alignof_type (location_t loc,
{ {
if (is_sizeof) if (is_sizeof)
/* Convert in case a char is more than one unit. */ /* Convert in case a char is more than one unit. */
value = size_binop (CEIL_DIV_EXPR, TYPE_SIZE_UNIT (type), value = size_binop_loc (loc, CEIL_DIV_EXPR, TYPE_SIZE_UNIT (type),
size_int (TYPE_PRECISION (char_type_node) size_int (TYPE_PRECISION (char_type_node)
/ BITS_PER_UNIT)); / BITS_PER_UNIT));
else else
value = size_int (TYPE_ALIGN_UNIT (type)); value = size_int (TYPE_ALIGN_UNIT (type));
} }
@ -4301,7 +4304,7 @@ c_sizeof_or_alignof_type (location_t loc,
TYPE_IS_SIZETYPE means that certain things (like overflow) will TYPE_IS_SIZETYPE means that certain things (like overflow) will
never happen. However, this node should really have type never happen. However, this node should really have type
`size_t', which is just a typedef for an ordinary integer type. */ `size_t', which is just a typedef for an ordinary integer type. */
value = fold_convert (size_type_node, value); value = fold_convert_loc (loc, size_type_node, value);
gcc_assert (!TYPE_IS_SIZETYPE (TREE_TYPE (value))); gcc_assert (!TYPE_IS_SIZETYPE (TREE_TYPE (value)));
return value; return value;
@ -4352,7 +4355,7 @@ c_alignof_expr (location_t loc, tree expr)
else else
return c_alignof (loc, TREE_TYPE (expr)); return c_alignof (loc, TREE_TYPE (expr));
return fold_convert (size_type_node, t); return fold_convert_loc (loc, size_type_node, t);
} }
/* Handle C and C++ default attributes. */ /* Handle C and C++ default attributes. */
@ -5628,11 +5631,11 @@ boolean_increment (enum tree_code code, tree arg)
break; break;
case PREDECREMENT_EXPR: case PREDECREMENT_EXPR:
val = build2 (MODIFY_EXPR, TREE_TYPE (arg), arg, val = build2 (MODIFY_EXPR, TREE_TYPE (arg), arg,
invert_truthvalue (arg)); invert_truthvalue_loc (input_location, arg));
break; break;
case POSTDECREMENT_EXPR: case POSTDECREMENT_EXPR:
val = build2 (MODIFY_EXPR, TREE_TYPE (arg), arg, val = build2 (MODIFY_EXPR, TREE_TYPE (arg), arg,
invert_truthvalue (arg)); invert_truthvalue_loc (input_location, arg));
arg = save_expr (arg); arg = save_expr (arg);
val = build2 (COMPOUND_EXPR, TREE_TYPE (arg), val, arg); val = build2 (COMPOUND_EXPR, TREE_TYPE (arg), val, arg);
val = build2 (COMPOUND_EXPR, TREE_TYPE (arg), arg, val); val = build2 (COMPOUND_EXPR, TREE_TYPE (arg), arg, val);
@ -8357,9 +8360,10 @@ fold_offsetof_1 (tree expr, tree stop_ref)
"member %qD", t); "member %qD", t);
return error_mark_node; return error_mark_node;
} }
off = size_binop (PLUS_EXPR, DECL_FIELD_OFFSET (t), off = size_binop_loc (input_location, PLUS_EXPR, DECL_FIELD_OFFSET (t),
size_int (tree_low_cst (DECL_FIELD_BIT_OFFSET (t), 1) size_int (tree_low_cst (DECL_FIELD_BIT_OFFSET (t),
/ BITS_PER_UNIT)); 1)
/ BITS_PER_UNIT));
break; break;
case ARRAY_REF: case ARRAY_REF:
@ -8371,7 +8375,7 @@ fold_offsetof_1 (tree expr, tree stop_ref)
if (TREE_CODE (t) == INTEGER_CST && tree_int_cst_sgn (t) < 0) if (TREE_CODE (t) == INTEGER_CST && tree_int_cst_sgn (t) < 0)
{ {
code = MINUS_EXPR; code = MINUS_EXPR;
t = fold_build1 (NEGATE_EXPR, TREE_TYPE (t), t); t = fold_build1_loc (input_location, NEGATE_EXPR, TREE_TYPE (t), t);
} }
t = convert (sizetype, t); t = convert (sizetype, t);
off = size_binop (MULT_EXPR, TYPE_SIZE_UNIT (TREE_TYPE (expr)), t); off = size_binop (MULT_EXPR, TYPE_SIZE_UNIT (TREE_TYPE (expr)), t);
@ -8464,9 +8468,9 @@ complete_array_type (tree *ptype, tree initial_value, bool do_default)
bool fold_p = false; bool fold_p = false;
if (VEC_index (constructor_elt, v, 0)->index) if (VEC_index (constructor_elt, v, 0)->index)
maxindex = fold_convert (sizetype, maxindex = fold_convert_loc (input_location, sizetype,
VEC_index (constructor_elt, VEC_index (constructor_elt,
v, 0)->index); v, 0)->index);
curindex = maxindex; curindex = maxindex;
for (cnt = 1; for (cnt = 1;
@ -8480,7 +8484,8 @@ complete_array_type (tree *ptype, tree initial_value, bool do_default)
{ {
if (fold_p) if (fold_p)
curindex = fold_convert (sizetype, curindex); curindex = fold_convert (sizetype, curindex);
curindex = size_binop (PLUS_EXPR, curindex, size_one_node); curindex = size_binop (PLUS_EXPR, curindex,
size_one_node);
} }
if (tree_int_cst_lt (maxindex, curindex)) if (tree_int_cst_lt (maxindex, curindex))
maxindex = curindex, fold_p = curfold_p; maxindex = curindex, fold_p = curfold_p;

View File

@ -830,7 +830,7 @@ extern tree shorten_binary_op (tree result_type, tree op0, tree op1, bool bitwis
and, if so, perhaps change them both back to their original type. */ and, if so, perhaps change them both back to their original type. */
extern tree shorten_compare (tree *, tree *, tree *, enum tree_code *); extern tree shorten_compare (tree *, tree *, tree *, enum tree_code *);
extern tree pointer_int_sum (enum tree_code, tree, tree); extern tree pointer_int_sum (location_t, enum tree_code, tree, tree);
/* Add qualifiers to a type, in the fashion for C. */ /* Add qualifiers to a type, in the fashion for C. */
extern tree c_build_qualified_type (tree, int); extern tree c_build_qualified_type (tree, int);

View File

@ -71,6 +71,7 @@ convert (tree type, tree expr)
enum tree_code code = TREE_CODE (type); enum tree_code code = TREE_CODE (type);
const char *invalid_conv_diag; const char *invalid_conv_diag;
tree ret; tree ret;
location_t loc = EXPR_LOCATION (expr);
if (type == error_mark_node if (type == error_mark_node
|| expr == error_mark_node || expr == error_mark_node
@ -93,7 +94,7 @@ convert (tree type, tree expr)
STRIP_TYPE_NOPS (e); STRIP_TYPE_NOPS (e);
if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (TREE_TYPE (expr))) if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (TREE_TYPE (expr)))
return fold_convert (type, expr); return fold_convert_loc (loc, type, expr);
if (TREE_CODE (TREE_TYPE (expr)) == ERROR_MARK) if (TREE_CODE (TREE_TYPE (expr)) == ERROR_MARK)
return error_mark_node; return error_mark_node;
if (TREE_CODE (TREE_TYPE (expr)) == VOID_TYPE) if (TREE_CODE (TREE_TYPE (expr)) == VOID_TYPE)
@ -105,7 +106,7 @@ convert (tree type, tree expr)
switch (code) switch (code)
{ {
case VOID_TYPE: case VOID_TYPE:
return fold_convert (type, e); return fold_convert_loc (loc, type, e);
case INTEGER_TYPE: case INTEGER_TYPE:
case ENUMERAL_TYPE: case ENUMERAL_TYPE:
@ -113,8 +114,8 @@ convert (tree type, tree expr)
goto maybe_fold; goto maybe_fold;
case BOOLEAN_TYPE: case BOOLEAN_TYPE:
return fold_convert return fold_convert_loc
(type, c_objc_common_truthvalue_conversion (input_location, expr)); (loc, type, c_objc_common_truthvalue_conversion (input_location, expr));
case POINTER_TYPE: case POINTER_TYPE:
case REFERENCE_TYPE: case REFERENCE_TYPE:

View File

@ -5224,10 +5224,10 @@ grokdeclarator (const struct c_declarator *declarator,
- 1. Do the calculation in index_type, so that - 1. Do the calculation in index_type, so that
if it is a variable the computations will be if it is a variable the computations will be
done in the proper mode. */ done in the proper mode. */
itype = fold_build2 (MINUS_EXPR, index_type, itype = fold_build2_loc (loc, MINUS_EXPR, index_type,
convert (index_type, size), convert (index_type, size),
convert (index_type, convert (index_type,
size_one_node)); size_one_node));
/* If that overflowed, the array is too big. ??? /* If that overflowed, the array is too big. ???
While a size of INT_MAX+1 technically shouldn't While a size of INT_MAX+1 technically shouldn't

View File

@ -81,8 +81,7 @@ c_finish_omp_barrier (location_t loc)
tree x; tree x;
x = built_in_decls[BUILT_IN_GOMP_BARRIER]; x = built_in_decls[BUILT_IN_GOMP_BARRIER];
x = build_call_expr (x, 0); x = build_call_expr_loc (loc, x, 0);
SET_EXPR_LOCATION (x, loc);
add_stmt (x); add_stmt (x);
} }
@ -96,8 +95,7 @@ c_finish_omp_taskwait (location_t loc)
tree x; tree x;
x = built_in_decls[BUILT_IN_GOMP_TASKWAIT]; x = built_in_decls[BUILT_IN_GOMP_TASKWAIT];
x = build_call_expr (x, 0); x = build_call_expr_loc (loc, x, 0);
SET_EXPR_LOCATION (x, loc);
add_stmt (x); add_stmt (x);
} }
@ -175,8 +173,7 @@ c_finish_omp_flush (location_t loc)
tree x; tree x;
x = built_in_decls[BUILT_IN_SYNCHRONIZE]; x = built_in_decls[BUILT_IN_SYNCHRONIZE];
x = build_call_expr (x, 0); x = build_call_expr_loc (loc, x, 0);
SET_EXPR_LOCATION (x, loc);
add_stmt (x); add_stmt (x);
} }
@ -185,7 +182,7 @@ c_finish_omp_flush (location_t loc)
Helper function for c_finish_omp_for. */ Helper function for c_finish_omp_for. */
static tree static tree
check_omp_for_incr_expr (tree exp, tree decl) check_omp_for_incr_expr (location_t loc, tree exp, tree decl)
{ {
tree t; tree t;
@ -199,22 +196,25 @@ check_omp_for_incr_expr (tree exp, tree decl)
switch (TREE_CODE (exp)) switch (TREE_CODE (exp))
{ {
CASE_CONVERT: CASE_CONVERT:
t = check_omp_for_incr_expr (TREE_OPERAND (exp, 0), decl); t = check_omp_for_incr_expr (loc, TREE_OPERAND (exp, 0), decl);
if (t != error_mark_node) if (t != error_mark_node)
return fold_convert (TREE_TYPE (exp), t); return fold_convert_loc (loc, TREE_TYPE (exp), t);
break; break;
case MINUS_EXPR: case MINUS_EXPR:
t = check_omp_for_incr_expr (TREE_OPERAND (exp, 0), decl); t = check_omp_for_incr_expr (loc, TREE_OPERAND (exp, 0), decl);
if (t != error_mark_node) if (t != error_mark_node)
return fold_build2 (MINUS_EXPR, TREE_TYPE (exp), t, TREE_OPERAND (exp, 1)); return fold_build2_loc (loc, MINUS_EXPR,
TREE_TYPE (exp), t, TREE_OPERAND (exp, 1));
break; break;
case PLUS_EXPR: case PLUS_EXPR:
t = check_omp_for_incr_expr (TREE_OPERAND (exp, 0), decl); t = check_omp_for_incr_expr (loc, TREE_OPERAND (exp, 0), decl);
if (t != error_mark_node) if (t != error_mark_node)
return fold_build2 (PLUS_EXPR, TREE_TYPE (exp), t, TREE_OPERAND (exp, 1)); return fold_build2_loc (loc, PLUS_EXPR,
t = check_omp_for_incr_expr (TREE_OPERAND (exp, 1), decl); TREE_TYPE (exp), t, TREE_OPERAND (exp, 1));
t = check_omp_for_incr_expr (loc, TREE_OPERAND (exp, 1), decl);
if (t != error_mark_node) if (t != error_mark_node)
return fold_build2 (PLUS_EXPR, TREE_TYPE (exp), TREE_OPERAND (exp, 0), t); return fold_build2_loc (loc, PLUS_EXPR,
TREE_TYPE (exp), TREE_OPERAND (exp, 0), t);
break; break;
default: default:
break; break;
@ -322,7 +322,7 @@ c_finish_omp_for (location_t locus, tree declv, tree initv, tree condv,
{ {
TREE_OPERAND (cond, 0) = TREE_OPERAND (op0, 0); TREE_OPERAND (cond, 0) = TREE_OPERAND (op0, 0);
TREE_OPERAND (cond, 1) TREE_OPERAND (cond, 1)
= fold_build1 (NOP_EXPR, TREE_TYPE (decl), = fold_build1_loc (elocus, NOP_EXPR, TREE_TYPE (decl),
TREE_OPERAND (cond, 1)); TREE_OPERAND (cond, 1));
} }
else if (TREE_CODE (op1) == NOP_EXPR else if (TREE_CODE (op1) == NOP_EXPR
@ -330,7 +330,7 @@ c_finish_omp_for (location_t locus, tree declv, tree initv, tree condv,
{ {
TREE_OPERAND (cond, 1) = TREE_OPERAND (op1, 0); TREE_OPERAND (cond, 1) = TREE_OPERAND (op1, 0);
TREE_OPERAND (cond, 0) TREE_OPERAND (cond, 0)
= fold_build1 (NOP_EXPR, TREE_TYPE (decl), = fold_build1_loc (elocus, NOP_EXPR, TREE_TYPE (decl),
TREE_OPERAND (cond, 0)); TREE_OPERAND (cond, 0));
} }
@ -396,11 +396,12 @@ c_finish_omp_for (location_t locus, tree declv, tree initv, tree condv,
if (POINTER_TYPE_P (TREE_TYPE (decl)) if (POINTER_TYPE_P (TREE_TYPE (decl))
&& TREE_OPERAND (incr, 1)) && TREE_OPERAND (incr, 1))
{ {
tree t = fold_convert (sizetype, TREE_OPERAND (incr, 1)); tree t = fold_convert_loc (elocus,
sizetype, TREE_OPERAND (incr, 1));
if (TREE_CODE (incr) == POSTDECREMENT_EXPR if (TREE_CODE (incr) == POSTDECREMENT_EXPR
|| TREE_CODE (incr) == PREDECREMENT_EXPR) || TREE_CODE (incr) == PREDECREMENT_EXPR)
t = fold_build1 (NEGATE_EXPR, sizetype, t); t = fold_build1_loc (elocus, NEGATE_EXPR, sizetype, t);
t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (decl), decl, t); t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (decl), decl, t);
incr = build2 (MODIFY_EXPR, void_type_node, decl, t); incr = build2 (MODIFY_EXPR, void_type_node, decl, t);
} }
@ -422,7 +423,8 @@ c_finish_omp_for (location_t locus, tree declv, tree initv, tree condv,
incr_ok = true; incr_ok = true;
else else
{ {
tree t = check_omp_for_incr_expr (TREE_OPERAND (incr, 1), tree t = check_omp_for_incr_expr (elocus,
TREE_OPERAND (incr, 1),
decl); decl);
if (t != error_mark_node) if (t != error_mark_node)
{ {

View File

@ -7338,7 +7338,7 @@ c_parser_omp_clause_num_threads (c_parser *parser, tree list)
} }
/* Attempt to statically determine when the number isn't positive. */ /* Attempt to statically determine when the number isn't positive. */
c = fold_build2 (LE_EXPR, boolean_type_node, t, c = fold_build2_loc (expr_loc, LE_EXPR, boolean_type_node, t,
build_int_cst (TREE_TYPE (t), 0)); build_int_cst (TREE_TYPE (t), 0));
if (CAN_HAVE_LOCATION_P (c)) if (CAN_HAVE_LOCATION_P (c))
SET_EXPR_LOCATION (c, expr_loc); SET_EXPR_LOCATION (c, expr_loc);

View File

@ -86,7 +86,7 @@ static int type_lists_compatible_p (const_tree, const_tree, bool *);
static tree lookup_field (tree, tree); static tree lookup_field (tree, tree);
static int convert_arguments (tree, VEC(tree,gc) *, VEC(tree,gc) *, tree, static int convert_arguments (tree, VEC(tree,gc) *, VEC(tree,gc) *, tree,
tree); tree);
static tree pointer_diff (tree, tree); static tree pointer_diff (location_t, tree, tree);
static tree convert_for_assignment (location_t, tree, tree, tree, static tree convert_for_assignment (location_t, tree, tree, tree,
enum impl_conv, bool, tree, tree, int); enum impl_conv, bool, tree, tree, int);
static tree valid_compound_expr_initializer (tree, tree); static tree valid_compound_expr_initializer (tree, tree);
@ -1625,9 +1625,9 @@ c_size_in_bytes (const_tree type)
} }
/* Convert in case a char is more than one unit. */ /* Convert in case a char is more than one unit. */
return size_binop (CEIL_DIV_EXPR, TYPE_SIZE_UNIT (type), return size_binop_loc (input_location, CEIL_DIV_EXPR, TYPE_SIZE_UNIT (type),
size_int (TYPE_PRECISION (char_type_node) size_int (TYPE_PRECISION (char_type_node)
/ BITS_PER_UNIT)); / BITS_PER_UNIT));
} }
/* Return either DECL or its known constant value (if it has one). */ /* Return either DECL or its known constant value (if it has one). */
@ -2586,7 +2586,7 @@ build_function_call_vec (location_t loc, tree function, VEC(tree,gc) *params,
if (VOID_TYPE_P (return_type)) if (VOID_TYPE_P (return_type))
{ {
if (TYPE_QUALS (return_type) != TYPE_UNQUALIFIED) if (TYPE_QUALS (return_type) != TYPE_UNQUALIFIED)
pedwarn (input_location, 0, pedwarn (loc, 0,
"function with qualified void return type called"); "function with qualified void return type called");
return trap; return trap;
} }
@ -2599,7 +2599,7 @@ build_function_call_vec (location_t loc, tree function, VEC(tree,gc) *params,
build_constructor (return_type, 0), build_constructor (return_type, 0),
false); false);
else else
rhs = fold_convert (return_type, integer_zero_node); rhs = fold_convert_loc (loc, return_type, integer_zero_node);
return require_complete_type (build2 (COMPOUND_EXPR, return_type, return require_complete_type (build2 (COMPOUND_EXPR, return_type,
trap, rhs)); trap, rhs));
@ -2623,23 +2623,24 @@ build_function_call_vec (location_t loc, tree function, VEC(tree,gc) *params,
&& !strncmp (IDENTIFIER_POINTER (name), "__builtin_", 10)) && !strncmp (IDENTIFIER_POINTER (name), "__builtin_", 10))
{ {
if (require_constant_value) if (require_constant_value)
result = fold_build_call_array_initializer (TREE_TYPE (fntype), result =
function, nargs, argarray); fold_build_call_array_initializer_loc (loc, TREE_TYPE (fntype),
function, nargs, argarray);
else else
result = fold_build_call_array (TREE_TYPE (fntype), result = fold_build_call_array_loc (loc, TREE_TYPE (fntype),
function, nargs, argarray); function, nargs, argarray);
if (TREE_CODE (result) == NOP_EXPR if (TREE_CODE (result) == NOP_EXPR
&& TREE_CODE (TREE_OPERAND (result, 0)) == INTEGER_CST) && TREE_CODE (TREE_OPERAND (result, 0)) == INTEGER_CST)
STRIP_TYPE_NOPS (result); STRIP_TYPE_NOPS (result);
} }
else else
result = build_call_array (TREE_TYPE (fntype), result = build_call_array_loc (loc, TREE_TYPE (fntype),
function, nargs, argarray); function, nargs, argarray);
if (VOID_TYPE_P (TREE_TYPE (result))) if (VOID_TYPE_P (TREE_TYPE (result)))
{ {
if (TYPE_QUALS (TREE_TYPE (result)) != TYPE_UNQUALIFIED) if (TYPE_QUALS (TREE_TYPE (result)) != TYPE_UNQUALIFIED)
pedwarn (input_location, 0, pedwarn (loc, 0,
"function with qualified void return type called"); "function with qualified void return type called");
return result; return result;
} }
@ -3058,7 +3059,7 @@ parser_build_binary_op (location_t location, enum tree_code code,
The resulting tree has type int. */ The resulting tree has type int. */
static tree static tree
pointer_diff (tree op0, tree op1) pointer_diff (location_t loc, tree op0, tree op1)
{ {
tree restype = ptrdiff_type_node; tree restype = ptrdiff_type_node;
@ -3067,10 +3068,10 @@ pointer_diff (tree op0, tree op1)
tree orig_op1 = op1; tree orig_op1 = op1;
if (TREE_CODE (target_type) == VOID_TYPE) if (TREE_CODE (target_type) == VOID_TYPE)
pedwarn (input_location, pedantic ? OPT_pedantic : OPT_Wpointer_arith, pedwarn (loc, pedantic ? OPT_pedantic : OPT_Wpointer_arith,
"pointer of type %<void *%> used in subtraction"); "pointer of type %<void *%> used in subtraction");
if (TREE_CODE (target_type) == FUNCTION_TYPE) if (TREE_CODE (target_type) == FUNCTION_TYPE)
pedwarn (input_location, pedantic ? OPT_pedantic : OPT_Wpointer_arith, pedwarn (loc, pedantic ? OPT_pedantic : OPT_Wpointer_arith,
"pointer to a function used in subtraction"); "pointer to a function used in subtraction");
/* If the conversion to ptrdiff_type does anything like widening or /* If the conversion to ptrdiff_type does anything like widening or
@ -3122,18 +3123,19 @@ pointer_diff (tree op0, tree op1)
Do not do default conversions on the minus operator Do not do default conversions on the minus operator
in case restype is a short type. */ in case restype is a short type. */
op0 = build_binary_op (input_location, op0 = build_binary_op (loc,
MINUS_EXPR, convert (restype, op0), MINUS_EXPR, convert (restype, op0),
convert (restype, op1), 0); convert (restype, op1), 0);
/* This generates an error if op1 is pointer to incomplete type. */ /* This generates an error if op1 is pointer to incomplete type. */
if (!COMPLETE_OR_VOID_TYPE_P (TREE_TYPE (TREE_TYPE (orig_op1)))) if (!COMPLETE_OR_VOID_TYPE_P (TREE_TYPE (TREE_TYPE (orig_op1))))
error ("arithmetic on pointer to an incomplete type"); error_at (loc, "arithmetic on pointer to an incomplete type");
/* This generates an error if op0 is pointer to incomplete type. */ /* This generates an error if op0 is pointer to incomplete type. */
op1 = c_size_in_bytes (target_type); op1 = c_size_in_bytes (target_type);
/* Divide by the size, in easiest possible way. */ /* Divide by the size, in easiest possible way. */
return fold_build2 (EXACT_DIV_EXPR, restype, op0, convert (restype, op1)); return fold_build2_loc (loc, EXACT_DIV_EXPR, restype,
op0, convert (restype, op1));
} }
/* Construct and perhaps optimize a tree representation /* Construct and perhaps optimize a tree representation
@ -3203,7 +3205,7 @@ build_unary_op (location_t location,
} }
else if (!noconvert) else if (!noconvert)
arg = default_conversion (arg); arg = default_conversion (arg);
arg = non_lvalue (arg); arg = non_lvalue_loc (location, arg);
break; break;
case NEGATE_EXPR: case NEGATE_EXPR:
@ -3274,7 +3276,7 @@ build_unary_op (location_t location,
return error_mark_node; return error_mark_node;
} }
arg = c_objc_common_truthvalue_conversion (location, arg); arg = c_objc_common_truthvalue_conversion (location, arg);
ret = invert_truthvalue (arg); ret = invert_truthvalue_loc (location, arg);
/* If the TRUTH_NOT_EXPR has been folded, reset the location. */ /* If the TRUTH_NOT_EXPR has been folded, reset the location. */
if (EXPR_P (ret) && EXPR_HAS_LOCATION (ret)) if (EXPR_P (ret) && EXPR_HAS_LOCATION (ret))
location = EXPR_LOCATION (ret); location = EXPR_LOCATION (ret);
@ -3284,7 +3286,8 @@ build_unary_op (location_t location,
if (TREE_CODE (arg) == COMPLEX_CST) if (TREE_CODE (arg) == COMPLEX_CST)
ret = TREE_REALPART (arg); ret = TREE_REALPART (arg);
else if (TREE_CODE (TREE_TYPE (arg)) == COMPLEX_TYPE) else if (TREE_CODE (TREE_TYPE (arg)) == COMPLEX_TYPE)
ret = fold_build1 (REALPART_EXPR, TREE_TYPE (TREE_TYPE (arg)), arg); ret = fold_build1_loc (location,
REALPART_EXPR, TREE_TYPE (TREE_TYPE (arg)), arg);
else else
ret = arg; ret = arg;
if (eptype && TREE_CODE (eptype) == COMPLEX_TYPE) if (eptype && TREE_CODE (eptype) == COMPLEX_TYPE)
@ -3295,9 +3298,11 @@ build_unary_op (location_t location,
if (TREE_CODE (arg) == COMPLEX_CST) if (TREE_CODE (arg) == COMPLEX_CST)
ret = TREE_IMAGPART (arg); ret = TREE_IMAGPART (arg);
else if (TREE_CODE (TREE_TYPE (arg)) == COMPLEX_TYPE) else if (TREE_CODE (TREE_TYPE (arg)) == COMPLEX_TYPE)
ret = fold_build1 (IMAGPART_EXPR, TREE_TYPE (TREE_TYPE (arg)), arg); ret = fold_build1_loc (location,
IMAGPART_EXPR, TREE_TYPE (TREE_TYPE (arg)), arg);
else else
ret = omit_one_operand (TREE_TYPE (arg), integer_zero_node, arg); ret = omit_one_operand_loc (location, TREE_TYPE (arg),
integer_zero_node, arg);
if (eptype && TREE_CODE (eptype) == COMPLEX_TYPE) if (eptype && TREE_CODE (eptype) == COMPLEX_TYPE)
eptype = TREE_TYPE (eptype); eptype = TREE_TYPE (eptype);
goto return_build_unary_op; goto return_build_unary_op;
@ -3405,7 +3410,7 @@ build_unary_op (location_t location,
} }
inc = c_size_in_bytes (TREE_TYPE (argtype)); inc = c_size_in_bytes (TREE_TYPE (argtype));
inc = fold_convert (sizetype, inc); inc = fold_convert_loc (location, sizetype, inc);
} }
else if (FRACT_MODE_P (TYPE_MODE (argtype))) else if (FRACT_MODE_P (TYPE_MODE (argtype)))
{ {
@ -3475,7 +3480,7 @@ build_unary_op (location_t location,
{ {
/* Don't let this be an lvalue. */ /* Don't let this be an lvalue. */
if (lvalue_p (TREE_OPERAND (arg, 0))) if (lvalue_p (TREE_OPERAND (arg, 0)))
return non_lvalue (TREE_OPERAND (arg, 0)); return non_lvalue_loc (location, TREE_OPERAND (arg, 0));
ret = TREE_OPERAND (arg, 0); ret = TREE_OPERAND (arg, 0);
goto return_build_unary_op; goto return_build_unary_op;
} }
@ -3541,10 +3546,11 @@ build_unary_op (location_t location,
if (val && TREE_CODE (val) == INDIRECT_REF if (val && TREE_CODE (val) == INDIRECT_REF
&& TREE_CONSTANT (TREE_OPERAND (val, 0))) && TREE_CONSTANT (TREE_OPERAND (val, 0)))
{ {
tree op0 = fold_convert (sizetype, fold_offsetof (arg, val)), op1; tree op0 = fold_convert_loc (location, sizetype,
fold_offsetof (arg, val)), op1;
op1 = fold_convert (argtype, TREE_OPERAND (val, 0)); op1 = fold_convert_loc (location, argtype, TREE_OPERAND (val, 0));
ret = fold_build2 (POINTER_PLUS_EXPR, argtype, op1, op0); ret = fold_build2_loc (location, POINTER_PLUS_EXPR, argtype, op1, op0);
goto return_build_unary_op; goto return_build_unary_op;
} }
@ -3561,8 +3567,8 @@ build_unary_op (location_t location,
argtype = TREE_TYPE (arg); argtype = TREE_TYPE (arg);
if (TREE_CODE (arg) == INTEGER_CST) if (TREE_CODE (arg) == INTEGER_CST)
ret = (require_constant_value ret = (require_constant_value
? fold_build1_initializer (code, argtype, arg) ? fold_build1_initializer_loc (location, code, argtype, arg)
: fold_build1 (code, argtype, arg)); : fold_build1_loc (location, code, argtype, arg));
else else
ret = build1 (code, argtype, arg); ret = build1 (code, argtype, arg);
return_build_unary_op: return_build_unary_op:
@ -4048,7 +4054,7 @@ build_conditional_expr (location_t colon_loc, tree ifexp, bool ifexp_bcp,
&& !TREE_OVERFLOW (orig_op2))); && !TREE_OVERFLOW (orig_op2)));
} }
if (int_const || (ifexp_bcp && TREE_CODE (ifexp) == INTEGER_CST)) if (int_const || (ifexp_bcp && TREE_CODE (ifexp) == INTEGER_CST))
ret = fold_build3 (COND_EXPR, result_type, ifexp, op1, op2); ret = fold_build3_loc (colon_loc, COND_EXPR, result_type, ifexp, op1, op2);
else else
{ {
ret = build3 (COND_EXPR, result_type, ifexp, op1, op2); ret = build3 (COND_EXPR, result_type, ifexp, op1, op2);
@ -4402,7 +4408,7 @@ build_c_cast (location_t loc, tree type, tree expr)
/* Don't let a cast be an lvalue. */ /* Don't let a cast be an lvalue. */
if (value == expr) if (value == expr)
value = non_lvalue (value); value = non_lvalue_loc (loc, value);
/* Don't allow the results of casting to floating-point or complex /* Don't allow the results of casting to floating-point or complex
types be confused with actual constants, or casts involving types be confused with actual constants, or casts involving
@ -4939,7 +4945,7 @@ convert_for_assignment (location_t location, tree type, tree rhs,
pedwarn (location, OPT_pedantic, pedwarn (location, OPT_pedantic,
"ISO C prohibits argument conversion to union type"); "ISO C prohibits argument conversion to union type");
rhs = fold_convert (TREE_TYPE (memb), rhs); rhs = fold_convert_loc (location, TREE_TYPE (memb), rhs);
return build_constructor_single (type, memb, rhs); return build_constructor_single (type, memb, rhs);
} }
} }
@ -7316,8 +7322,8 @@ output_init_element (tree value, tree origtype, bool strict_string, tree type,
/* Advance the variable that indicates sequential elements output. */ /* Advance the variable that indicates sequential elements output. */
if (TREE_CODE (constructor_type) == ARRAY_TYPE) if (TREE_CODE (constructor_type) == ARRAY_TYPE)
constructor_unfilled_index constructor_unfilled_index
= size_binop (PLUS_EXPR, constructor_unfilled_index, = size_binop_loc (input_location, PLUS_EXPR, constructor_unfilled_index,
bitsize_one_node); bitsize_one_node);
else if (TREE_CODE (constructor_type) == RECORD_TYPE) else if (TREE_CODE (constructor_type) == RECORD_TYPE)
{ {
constructor_unfilled_fields constructor_unfilled_fields
@ -7632,9 +7638,9 @@ process_init_element (struct c_expr value, bool implicit)
/* For a record, keep track of end position of last field. */ /* For a record, keep track of end position of last field. */
if (DECL_SIZE (constructor_fields)) if (DECL_SIZE (constructor_fields))
constructor_bit_index constructor_bit_index
= size_binop (PLUS_EXPR, = size_binop_loc (input_location, PLUS_EXPR,
bit_position (constructor_fields), bit_position (constructor_fields),
DECL_SIZE (constructor_fields)); DECL_SIZE (constructor_fields));
/* If the current field was the first one not yet written out, /* If the current field was the first one not yet written out,
it isn't now, so update. */ it isn't now, so update. */
@ -7769,7 +7775,8 @@ process_init_element (struct c_expr value, bool implicit)
} }
constructor_index constructor_index
= size_binop (PLUS_EXPR, constructor_index, bitsize_one_node); = size_binop_loc (input_location, PLUS_EXPR,
constructor_index, bitsize_one_node);
if (!value.value) if (!value.value)
/* If we are doing the bookkeeping for an element that was /* If we are doing the bookkeeping for an element that was
@ -7801,7 +7808,8 @@ process_init_element (struct c_expr value, bool implicit)
} }
constructor_index constructor_index
= size_binop (PLUS_EXPR, constructor_index, bitsize_one_node); = size_binop_loc (input_location,
PLUS_EXPR, constructor_index, bitsize_one_node);
if (!value.value) if (!value.value)
/* If we are doing the bookkeeping for an element that was /* If we are doing the bookkeeping for an element that was
@ -7850,7 +7858,8 @@ process_init_element (struct c_expr value, bool implicit)
process_init_element (pop_init_level (1), true); process_init_element (pop_init_level (1), true);
} }
p->index = size_binop (PLUS_EXPR, p->index, bitsize_one_node); p->index = size_binop_loc (input_location,
PLUS_EXPR, p->index, bitsize_one_node);
if (tree_int_cst_equal (p->index, p->range_end) && !p->prev) if (tree_int_cst_equal (p->index, p->range_end) && !p->prev)
finish = 1; finish = 1;
@ -8416,11 +8425,12 @@ c_finish_loop (location_t start_locus, tree cond, tree incr, tree body,
} }
t = build_and_jump (&blab); t = build_and_jump (&blab);
exit = fold_build3 (COND_EXPR, void_type_node, cond, exit, t);
if (cond_is_first) if (cond_is_first)
SET_EXPR_LOCATION (exit, start_locus); exit = fold_build3_loc (start_locus,
COND_EXPR, void_type_node, cond, exit, t);
else else
SET_EXPR_LOCATION (exit, input_location); exit = fold_build3_loc (input_location,
COND_EXPR, void_type_node, cond, exit, t);
} }
add_stmt (top); add_stmt (top);
@ -8935,12 +8945,12 @@ build_binary_op (location_t location, enum tree_code code,
/* Handle the pointer + int case. */ /* Handle the pointer + int case. */
if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE) if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE)
{ {
ret = pointer_int_sum (PLUS_EXPR, op0, op1); ret = pointer_int_sum (location, PLUS_EXPR, op0, op1);
goto return_build_binary_op; goto return_build_binary_op;
} }
else if (code1 == POINTER_TYPE && code0 == INTEGER_TYPE) else if (code1 == POINTER_TYPE && code0 == INTEGER_TYPE)
{ {
ret = pointer_int_sum (PLUS_EXPR, op1, op0); ret = pointer_int_sum (location, PLUS_EXPR, op1, op0);
goto return_build_binary_op; goto return_build_binary_op;
} }
else else
@ -8953,13 +8963,13 @@ build_binary_op (location_t location, enum tree_code code,
if (code0 == POINTER_TYPE && code1 == POINTER_TYPE if (code0 == POINTER_TYPE && code1 == POINTER_TYPE
&& comp_target_types (location, type0, type1)) && comp_target_types (location, type0, type1))
{ {
ret = pointer_diff (op0, op1); ret = pointer_diff (location, op0, op1);
goto return_build_binary_op; goto return_build_binary_op;
} }
/* Handle pointer minus int. Just like pointer plus int. */ /* Handle pointer minus int. Just like pointer plus int. */
else if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE) else if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE)
{ {
ret = pointer_int_sum (MINUS_EXPR, op0, op1); ret = pointer_int_sum (location, MINUS_EXPR, op0, op1);
goto return_build_binary_op; goto return_build_binary_op;
} }
else else
@ -9572,8 +9582,9 @@ build_binary_op (location_t location, enum tree_code code,
/* Treat expressions in initializers specially as they can't trap. */ /* Treat expressions in initializers specially as they can't trap. */
if (int_const_or_overflow) if (int_const_or_overflow)
ret = (require_constant_value ret = (require_constant_value
? fold_build2_initializer (resultcode, build_type, op0, op1) ? fold_build2_initializer_loc (location, resultcode, build_type,
: fold_build2 (resultcode, build_type, op0, op1)); op0, op1)
: fold_build2_loc (location, resultcode, build_type, op0, op1));
else else
ret = build2 (resultcode, build_type, op0, op1); ret = build2 (resultcode, build_type, op0, op1);
if (final_type != 0) if (final_type != 0)

View File

@ -949,6 +949,7 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED,
int *must_preallocate, int *ecf_flags, int *must_preallocate, int *ecf_flags,
bool *may_tailcall, bool call_from_thunk_p) bool *may_tailcall, bool call_from_thunk_p)
{ {
location_t loc = EXPR_LOCATION (exp);
/* 1 if scanning parms front to back, -1 if scanning back to front. */ /* 1 if scanning parms front to back, -1 if scanning back to front. */
int inc; int inc;
@ -1062,7 +1063,8 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED,
if (!call_from_thunk_p && DECL_P (base) && !TREE_STATIC (base)) if (!call_from_thunk_p && DECL_P (base) && !TREE_STATIC (base))
*may_tailcall = false; *may_tailcall = false;
args[i].tree_value = build_fold_addr_expr (args[i].tree_value); args[i].tree_value = build_fold_addr_expr_loc (loc,
args[i].tree_value);
type = TREE_TYPE (args[i].tree_value); type = TREE_TYPE (args[i].tree_value);
if (*ecf_flags & ECF_CONST) if (*ecf_flags & ECF_CONST)
@ -1114,7 +1116,7 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED,
*ecf_flags &= ~(ECF_PURE | ECF_LOOPING_CONST_OR_PURE); *ecf_flags &= ~(ECF_PURE | ECF_LOOPING_CONST_OR_PURE);
args[i].tree_value args[i].tree_value
= build_fold_addr_expr (make_tree (type, copy)); = build_fold_addr_expr_loc (loc, make_tree (type, copy));
type = TREE_TYPE (args[i].tree_value); type = TREE_TYPE (args[i].tree_value);
*may_tailcall = false; *may_tailcall = false;
} }

View File

@ -208,7 +208,8 @@ build_cdtor (bool ctor_p, tree *cdtors, size_t len)
priority = p; priority = p;
else if (p != priority) else if (p != priority)
break; break;
append_to_statement_list (build_function_call_expr (fn, 0), append_to_statement_list (build_function_call_expr (UNKNOWN_LOCATION,
fn, 0),
&body); &body);
++i; ++i;
} }

View File

@ -42,6 +42,7 @@ along with GCC; see the file COPYING3. If not see
tree tree
convert_to_pointer (tree type, tree expr) convert_to_pointer (tree type, tree expr)
{ {
location_t loc = EXPR_LOCATION (expr);
if (TREE_TYPE (expr) == type) if (TREE_TYPE (expr) == type)
return expr; return expr;
@ -53,16 +54,16 @@ convert_to_pointer (tree type, tree expr)
{ {
case POINTER_TYPE: case POINTER_TYPE:
case REFERENCE_TYPE: case REFERENCE_TYPE:
return fold_build1 (NOP_EXPR, type, expr); return fold_build1_loc (loc, NOP_EXPR, type, expr);
case INTEGER_TYPE: case INTEGER_TYPE:
case ENUMERAL_TYPE: case ENUMERAL_TYPE:
case BOOLEAN_TYPE: case BOOLEAN_TYPE:
if (TYPE_PRECISION (TREE_TYPE (expr)) != POINTER_SIZE) if (TYPE_PRECISION (TREE_TYPE (expr)) != POINTER_SIZE)
expr = fold_build1 (NOP_EXPR, expr = fold_build1_loc (loc, NOP_EXPR,
lang_hooks.types.type_for_size (POINTER_SIZE, 0), lang_hooks.types.type_for_size (POINTER_SIZE, 0),
expr); expr);
return fold_build1 (CONVERT_EXPR, type, expr); return fold_build1_loc (loc, CONVERT_EXPR, type, expr);
default: default:

View File

@ -1,3 +1,21 @@
2009-07-17 Aldy Hernandez <aldyh@redhat.com>
Manuel López-Ibáñez <manu@gcc.gnu.org>
PR 40435
* typeck.c, init.c, class.c, method.c, rtti.c, except.c, error.c,
tree.c, cp-gimplify.c, cxx-pretty-print.c, pt.c, semantics.c,
call.c, cvt.c, mangle.c: Add location argument to
fold_{unary,binary,ternary}, fold_build[123], build_call_expr,
build_size_arg, build_fold_addr_expr, build_call_array,
non_lvalue, size_diffop, fold_build1_initializer,
fold_build2_initializer, fold_build3_initializer,
fold_build_call_array, fold_build_call_array_initializer,
fold_single_bit_test, omit_one_operand, omit_two_operands,
invert_truthvalue, fold_truth_not_expr, build_fold_indirect_ref,
fold_indirect_ref, combine_comparisons, fold_builtin_*,
fold_call_expr, build_range_check, maybe_fold_offset_to_address,
round_up, round_down.
2009-07-16 Jason Merrill <jason@redhat.com> 2009-07-16 Jason Merrill <jason@redhat.com>
PR libstdc++/37907 PR libstdc++/37907

View File

@ -362,7 +362,8 @@ build_call_a (tree function, int n, tree *argarray)
argarray[i], t); argarray[i], t);
} }
function = build_call_array (result_type, function, n, argarray); function = build_call_array_loc (input_location,
result_type, function, n, argarray);
TREE_HAS_CONSTRUCTOR (function) = is_constructor; TREE_HAS_CONSTRUCTOR (function) = is_constructor;
TREE_NOTHROW (function) = nothrow; TREE_NOTHROW (function) = nothrow;
@ -5365,8 +5366,9 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
alcarray[ix + 1] = arg; alcarray[ix + 1] = arg;
argarray = alcarray; argarray = alcarray;
} }
expr = build_call_array (return_type, build_addr_func (fn), nargs, expr = build_call_array_loc (input_location,
argarray); return_type, build_addr_func (fn), nargs,
argarray);
if (TREE_THIS_VOLATILE (fn) && cfun) if (TREE_THIS_VOLATILE (fn) && cfun)
current_function_returns_abnormally = 1; current_function_returns_abnormally = 1;
if (!VOID_TYPE_P (return_type)) if (!VOID_TYPE_P (return_type))

View File

@ -333,7 +333,7 @@ build_base_path (enum tree_code code,
if (null_test) if (null_test)
{ {
tree zero = cp_convert (TREE_TYPE (expr), integer_zero_node); tree zero = cp_convert (TREE_TYPE (expr), integer_zero_node);
null_test = fold_build2 (NE_EXPR, boolean_type_node, null_test = fold_build2_loc (input_location, NE_EXPR, boolean_type_node,
expr, zero); expr, zero);
} }
@ -385,7 +385,7 @@ build_base_path (enum tree_code code,
TREE_CONSTANT (v_offset) = 1; TREE_CONSTANT (v_offset) = 1;
offset = convert_to_integer (ptrdiff_type_node, offset = convert_to_integer (ptrdiff_type_node,
size_diffop (offset, size_diffop_loc (input_location, offset,
BINFO_OFFSET (v_binfo))); BINFO_OFFSET (v_binfo)));
if (!integer_zerop (offset)) if (!integer_zerop (offset))
@ -417,7 +417,7 @@ build_base_path (enum tree_code code,
{ {
offset = fold_convert (sizetype, offset); offset = fold_convert (sizetype, offset);
if (code == MINUS_EXPR) if (code == MINUS_EXPR)
offset = fold_build1 (NEGATE_EXPR, sizetype, offset); offset = fold_build1_loc (input_location, NEGATE_EXPR, sizetype, offset);
expr = build2 (POINTER_PLUS_EXPR, ptr_target_type, expr, offset); expr = build2 (POINTER_PLUS_EXPR, ptr_target_type, expr, offset);
} }
else else
@ -428,8 +428,8 @@ build_base_path (enum tree_code code,
out: out:
if (null_test) if (null_test)
expr = fold_build3 (COND_EXPR, target_type, null_test, expr, expr = fold_build3_loc (input_location, COND_EXPR, target_type, null_test, expr,
fold_build1 (NOP_EXPR, target_type, fold_build1_loc (input_location, NOP_EXPR, target_type,
integer_zero_node)); integer_zero_node));
return expr; return expr;
@ -553,10 +553,11 @@ convert_to_base_statically (tree expr, tree base)
expr = cp_build_unary_op (ADDR_EXPR, expr, /*noconvert=*/1, expr = cp_build_unary_op (ADDR_EXPR, expr, /*noconvert=*/1,
tf_warning_or_error); tf_warning_or_error);
if (!integer_zerop (BINFO_OFFSET (base))) if (!integer_zerop (BINFO_OFFSET (base)))
expr = fold_build2 (POINTER_PLUS_EXPR, pointer_type, expr, expr = fold_build2_loc (input_location,
POINTER_PLUS_EXPR, pointer_type, expr,
fold_convert (sizetype, BINFO_OFFSET (base))); fold_convert (sizetype, BINFO_OFFSET (base)));
expr = fold_convert (build_pointer_type (BINFO_TYPE (base)), expr); expr = fold_convert (build_pointer_type (BINFO_TYPE (base)), expr);
expr = build_fold_indirect_ref (expr); expr = build_fold_indirect_ref_loc (input_location, expr);
} }
return expr; return expr;
@ -1396,7 +1397,8 @@ determine_primary_bases (tree t)
/* A virtual binfo might have been copied from within /* A virtual binfo might have been copied from within
another hierarchy. As we're about to use it as a another hierarchy. As we're about to use it as a
primary base, make sure the offsets match. */ primary base, make sure the offsets match. */
delta = size_diffop (convert (ssizetype, delta = size_diffop_loc (input_location,
convert (ssizetype,
BINFO_OFFSET (base_binfo)), BINFO_OFFSET (base_binfo)),
convert (ssizetype, convert (ssizetype,
BINFO_OFFSET (this_primary))); BINFO_OFFSET (this_primary)));
@ -1459,7 +1461,7 @@ determine_primary_bases (tree t)
/* A virtual binfo might have been copied from within /* A virtual binfo might have been copied from within
another hierarchy. As we're about to use it as a primary another hierarchy. As we're about to use it as a primary
base, make sure the offsets match. */ base, make sure the offsets match. */
delta = size_diffop (ssize_int (0), delta = size_diffop_loc (input_location, ssize_int (0),
convert (ssizetype, BINFO_OFFSET (primary))); convert (ssizetype, BINFO_OFFSET (primary)));
propagate_binfo_offsets (primary, delta); propagate_binfo_offsets (primary, delta);
@ -2162,9 +2164,10 @@ update_vtable_entry_for_fn (tree t, tree binfo, tree fn, tree* virtuals,
{ {
/* We convert via virtual base. Adjust the fixed /* We convert via virtual base. Adjust the fixed
offset to be from there. */ offset to be from there. */
offset = size_diffop offset =
(offset, convert size_diffop (offset,
(ssizetype, BINFO_OFFSET (virtual_offset))); convert (ssizetype,
BINFO_OFFSET (virtual_offset)));
} }
if (fixed_offset) if (fixed_offset)
/* There was an existing fixed offset, this must be /* There was an existing fixed offset, this must be
@ -2247,7 +2250,8 @@ update_vtable_entry_for_fn (tree t, tree binfo, tree fn, tree* virtuals,
if (virtual_base) if (virtual_base)
/* The `this' pointer needs to be adjusted from the declaration to /* The `this' pointer needs to be adjusted from the declaration to
the nearest virtual base. */ the nearest virtual base. */
delta = size_diffop (convert (ssizetype, BINFO_OFFSET (virtual_base)), delta = size_diffop_loc (input_location,
convert (ssizetype, BINFO_OFFSET (virtual_base)),
convert (ssizetype, BINFO_OFFSET (first_defn))); convert (ssizetype, BINFO_OFFSET (first_defn)));
else if (lost) else if (lost)
/* If the nearest definition is in a lost primary, we don't need an /* If the nearest definition is in a lost primary, we don't need an
@ -2260,7 +2264,8 @@ update_vtable_entry_for_fn (tree t, tree binfo, tree fn, tree* virtuals,
BINFO to pointing at the base where the final overrider BINFO to pointing at the base where the final overrider
appears. */ appears. */
virtual_covariant: virtual_covariant:
delta = size_diffop (convert (ssizetype, delta = size_diffop_loc (input_location,
convert (ssizetype,
BINFO_OFFSET (TREE_VALUE (overrider))), BINFO_OFFSET (TREE_VALUE (overrider))),
convert (ssizetype, BINFO_OFFSET (binfo))); convert (ssizetype, BINFO_OFFSET (binfo)));
@ -3574,7 +3579,8 @@ layout_nonempty_base_or_field (record_layout_info rli,
hierarchy. Therefore, we may not need to add the entire hierarchy. Therefore, we may not need to add the entire
OFFSET. */ OFFSET. */
propagate_binfo_offsets (binfo, propagate_binfo_offsets (binfo,
size_diffop (convert (ssizetype, offset), size_diffop_loc (input_location,
convert (ssizetype, offset),
convert (ssizetype, convert (ssizetype,
BINFO_OFFSET (binfo)))); BINFO_OFFSET (binfo))));
} }
@ -3611,7 +3617,8 @@ layout_empty_base (record_layout_info rli, tree binfo,
{ {
if (abi_version_at_least (2)) if (abi_version_at_least (2))
propagate_binfo_offsets propagate_binfo_offsets
(binfo, size_diffop (size_zero_node, BINFO_OFFSET (binfo))); (binfo, size_diffop_loc (input_location,
size_zero_node, BINFO_OFFSET (binfo)));
else else
warning (OPT_Wabi, warning (OPT_Wabi,
"offset of empty base %qT may not be ABI-compliant and may" "offset of empty base %qT may not be ABI-compliant and may"
@ -3717,7 +3724,8 @@ build_base_field (record_layout_info rli, tree binfo,
/* On some platforms (ARM), even empty classes will not be /* On some platforms (ARM), even empty classes will not be
byte-aligned. */ byte-aligned. */
eoc = round_up (rli_size_unit_so_far (rli), eoc = round_up_loc (input_location,
rli_size_unit_so_far (rli),
CLASSTYPE_ALIGN_UNIT (basetype)); CLASSTYPE_ALIGN_UNIT (basetype));
atend = layout_empty_base (rli, binfo, eoc, offsets); atend = layout_empty_base (rli, binfo, eoc, offsets);
/* A nearly-empty class "has no proper base class that is empty, /* A nearly-empty class "has no proper base class that is empty,
@ -4637,7 +4645,8 @@ layout_virtual_bases (record_layout_info rli, splay_tree offsets)
&& first_vbase && first_vbase
&& (tree_int_cst_lt && (tree_int_cst_lt
(size_binop (CEIL_DIV_EXPR, (size_binop (CEIL_DIV_EXPR,
round_up (CLASSTYPE_SIZE (t), round_up_loc (input_location,
CLASSTYPE_SIZE (t),
CLASSTYPE_ALIGN (basetype)), CLASSTYPE_ALIGN (basetype)),
bitsize_unit_node), bitsize_unit_node),
BINFO_OFFSET (vbase)))) BINFO_OFFSET (vbase))))
@ -5070,7 +5079,7 @@ layout_class_type (tree t, tree *virtuals_p)
/* Make sure that we are on a byte boundary so that the size of /* Make sure that we are on a byte boundary so that the size of
the class without virtual bases will always be a round number the class without virtual bases will always be a round number
of bytes. */ of bytes. */
rli->bitpos = round_up (rli->bitpos, BITS_PER_UNIT); rli->bitpos = round_up_loc (input_location, rli->bitpos, BITS_PER_UNIT);
normalize_rli (rli); normalize_rli (rli);
} }
@ -7765,11 +7774,12 @@ build_vbase_offset_vtbl_entries (tree binfo, vtbl_init_data* vid)
The vbase offsets go in reverse inheritance-graph order, and The vbase offsets go in reverse inheritance-graph order, and
we are walking in inheritance graph order so these end up in we are walking in inheritance graph order so these end up in
the right order. */ the right order. */
delta = size_diffop (BINFO_OFFSET (b), BINFO_OFFSET (non_primary_binfo)); delta = size_diffop_loc (input_location,
BINFO_OFFSET (b), BINFO_OFFSET (non_primary_binfo));
*vid->last_init *vid->last_init
= build_tree_list (NULL_TREE, = build_tree_list (NULL_TREE,
fold_build1 (NOP_EXPR, fold_build1_loc (input_location, NOP_EXPR,
vtable_entry_type, vtable_entry_type,
delta)); delta));
vid->last_init = &TREE_CHAIN (*vid->last_init); vid->last_init = &TREE_CHAIN (*vid->last_init);
@ -7999,9 +8009,11 @@ add_vcall_offset (tree orig_fn, tree binfo, vtbl_init_data *vid)
vid->binfo. But it might be a lost primary, so its vid->binfo. But it might be a lost primary, so its
BINFO_OFFSET might be wrong, so we just use the BINFO_OFFSET might be wrong, so we just use the
BINFO_OFFSET from vid->binfo. */ BINFO_OFFSET from vid->binfo. */
vcall_offset = size_diffop (BINFO_OFFSET (base), vcall_offset = size_diffop_loc (input_location,
BINFO_OFFSET (base),
BINFO_OFFSET (vid->binfo)); BINFO_OFFSET (vid->binfo));
vcall_offset = fold_build1 (NOP_EXPR, vtable_entry_type, vcall_offset = fold_build1_loc (input_location,
NOP_EXPR, vtable_entry_type,
vcall_offset); vcall_offset);
} }
/* Add the initializer to the vtable. */ /* Add the initializer to the vtable. */
@ -8040,7 +8052,8 @@ build_rtti_vtbl_entries (tree binfo, vtbl_init_data* vid)
&& BINFO_INHERITANCE_CHAIN (primary_base) == b); && BINFO_INHERITANCE_CHAIN (primary_base) == b);
b = primary_base; b = primary_base;
} }
offset = size_diffop (BINFO_OFFSET (vid->rtti_binfo), BINFO_OFFSET (b)); offset = size_diffop_loc (input_location,
BINFO_OFFSET (vid->rtti_binfo), BINFO_OFFSET (b));
/* The second entry is the address of the typeinfo object. */ /* The second entry is the address of the typeinfo object. */
if (flag_rtti) if (flag_rtti)

View File

@ -924,9 +924,9 @@ cxx_omp_clause_apply_fn (tree fn, tree arg1, tree arg2)
size_zero_node, NULL, NULL); size_zero_node, NULL, NULL);
} }
while (TREE_CODE (inner_type) == ARRAY_TYPE); while (TREE_CODE (inner_type) == ARRAY_TYPE);
start1 = build_fold_addr_expr (start1); start1 = build_fold_addr_expr_loc (input_location, start1);
if (arg2) if (arg2)
start2 = build_fold_addr_expr (start2); start2 = build_fold_addr_expr_loc (input_location, start2);
end1 = TYPE_SIZE_UNIT (TREE_TYPE (arg1)); end1 = TYPE_SIZE_UNIT (TREE_TYPE (arg1));
end1 = build2 (POINTER_PLUS_EXPR, TREE_TYPE (start1), start1, end1); end1 = build2 (POINTER_PLUS_EXPR, TREE_TYPE (start1), start1, end1);
@ -980,9 +980,9 @@ cxx_omp_clause_apply_fn (tree fn, tree arg1, tree arg2)
} }
else else
{ {
argarray[i++] = build_fold_addr_expr (arg1); argarray[i++] = build_fold_addr_expr_loc (input_location, arg1);
if (arg2) if (arg2)
argarray[i++] = build_fold_addr_expr (arg2); argarray[i++] = build_fold_addr_expr_loc (input_location, arg2);
/* Handle default arguments. */ /* Handle default arguments. */
for (parm = defparm; parm && parm != void_list_node; for (parm = defparm; parm && parm != void_list_node;
parm = TREE_CHAIN (parm), i++) parm = TREE_CHAIN (parm), i++)

View File

@ -936,10 +936,11 @@ convert_to_void (tree expr, const char *implicit, tsubst_flags_t complain)
&& !AGGR_INIT_VIA_CTOR_P (init)) && !AGGR_INIT_VIA_CTOR_P (init))
{ {
tree fn = AGGR_INIT_EXPR_FN (init); tree fn = AGGR_INIT_EXPR_FN (init);
expr = build_call_array (TREE_TYPE (TREE_TYPE (TREE_TYPE (fn))), expr = build_call_array_loc (input_location,
fn, TREE_TYPE (TREE_TYPE (TREE_TYPE (fn))),
aggr_init_expr_nargs (init), fn,
AGGR_INIT_EXPR_ARGP (init)); aggr_init_expr_nargs (init),
AGGR_INIT_EXPR_ARGP (init));
} }
} }
break; break;

View File

@ -659,7 +659,8 @@ pp_cxx_new_expression (cxx_pretty_printer *pp, tree t)
if (TREE_CODE (type) == ARRAY_REF) if (TREE_CODE (type) == ARRAY_REF)
type = build_cplus_array_type type = build_cplus_array_type
(TREE_OPERAND (type, 0), (TREE_OPERAND (type, 0),
build_index_type (fold_build2 (MINUS_EXPR, integer_type_node, build_index_type (fold_build2_loc (input_location,
MINUS_EXPR, integer_type_node,
TREE_OPERAND (type, 1), TREE_OPERAND (type, 1),
integer_one_node))); integer_one_node)));
pp_cxx_type_id (pp, type); pp_cxx_type_id (pp, type);

View File

@ -770,7 +770,8 @@ dump_type_suffix (tree t, int flags)
dump_expr (TREE_OPERAND (max, 0), dump_expr (TREE_OPERAND (max, 0),
flags & ~TFF_EXPR_IN_PARENS); flags & ~TFF_EXPR_IN_PARENS);
else else
dump_expr (fold_build2 (PLUS_EXPR, dtype, max, dump_expr (fold_build2_loc (input_location,
PLUS_EXPR, dtype, max,
build_int_cst (dtype, 1)), build_int_cst (dtype, 1)),
flags & ~TFF_EXPR_IN_PARENS); flags & ~TFF_EXPR_IN_PARENS);
} }

View File

@ -450,7 +450,8 @@ expand_start_catch_block (tree decl)
exp = build_exc_ptr (); exp = build_exc_ptr ();
exp = build1 (NOP_EXPR, build_pointer_type (type), exp); exp = build1 (NOP_EXPR, build_pointer_type (type), exp);
exp = build2 (POINTER_PLUS_EXPR, TREE_TYPE (exp), exp, exp = build2 (POINTER_PLUS_EXPR, TREE_TYPE (exp), exp,
fold_build1 (NEGATE_EXPR, sizetype, fold_build1_loc (input_location,
NEGATE_EXPR, sizetype,
TYPE_SIZE_UNIT (TREE_TYPE (exp)))); TYPE_SIZE_UNIT (TREE_TYPE (exp))));
exp = cp_build_indirect_ref (exp, NULL, tf_warning_or_error); exp = cp_build_indirect_ref (exp, NULL, tf_warning_or_error);
initialize_handler_parm (decl, exp); initialize_handler_parm (decl, exp);

View File

@ -219,7 +219,8 @@ build_zero_init (tree type, tree nelts, bool static_storage_p)
/* Iterate over the array elements, building initializations. */ /* Iterate over the array elements, building initializations. */
if (nelts) if (nelts)
max_index = fold_build2 (MINUS_EXPR, TREE_TYPE (nelts), max_index = fold_build2_loc (input_location,
MINUS_EXPR, TREE_TYPE (nelts),
nelts, integer_one_node); nelts, integer_one_node);
else else
max_index = array_type_nelts (type); max_index = array_type_nelts (type);
@ -965,7 +966,8 @@ expand_cleanup_for_base (tree binfo, tree flag)
LOOKUP_NORMAL | LOOKUP_NONVIRTUAL, LOOKUP_NORMAL | LOOKUP_NONVIRTUAL,
tf_warning_or_error); tf_warning_or_error);
if (flag) if (flag)
expr = fold_build3 (COND_EXPR, void_type_node, expr = fold_build3_loc (input_location,
COND_EXPR, void_type_node,
c_common_truthvalue_conversion (input_location, flag), c_common_truthvalue_conversion (input_location, flag),
expr, integer_zero_node); expr, integer_zero_node);
@ -2048,7 +2050,8 @@ build_new_1 (VEC(tree,gc) **placement, tree type, tree nelts,
many elements to destroy later. We use the last sizeof many elements to destroy later. We use the last sizeof
(size_t) bytes to store the number of elements. */ (size_t) bytes to store the number of elements. */
cookie_ptr = size_binop (MINUS_EXPR, cookie_size, size_in_bytes (sizetype)); cookie_ptr = size_binop (MINUS_EXPR, cookie_size, size_in_bytes (sizetype));
cookie_ptr = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (alloc_node), cookie_ptr = fold_build2_loc (input_location,
POINTER_PLUS_EXPR, TREE_TYPE (alloc_node),
alloc_node, cookie_ptr); alloc_node, cookie_ptr);
size_ptr_type = build_pointer_type (sizetype); size_ptr_type = build_pointer_type (sizetype);
cookie_ptr = fold_convert (size_ptr_type, cookie_ptr); cookie_ptr = fold_convert (size_ptr_type, cookie_ptr);
@ -2060,7 +2063,8 @@ build_new_1 (VEC(tree,gc) **placement, tree type, tree nelts,
{ {
/* Also store the element size. */ /* Also store the element size. */
cookie_ptr = build2 (POINTER_PLUS_EXPR, size_ptr_type, cookie_ptr, cookie_ptr = build2 (POINTER_PLUS_EXPR, size_ptr_type, cookie_ptr,
fold_build1 (NEGATE_EXPR, sizetype, fold_build1_loc (input_location,
NEGATE_EXPR, sizetype,
size_in_bytes (sizetype))); size_in_bytes (sizetype)));
cookie = cp_build_indirect_ref (cookie_ptr, NULL, complain); cookie = cp_build_indirect_ref (cookie_ptr, NULL, complain);
@ -2498,7 +2502,8 @@ build_vec_delete_1 (tree base, tree maxindex, tree type,
tbase = create_temporary_var (ptype); tbase = create_temporary_var (ptype);
tbase_init = cp_build_modify_expr (tbase, NOP_EXPR, tbase_init = cp_build_modify_expr (tbase, NOP_EXPR,
fold_build2 (POINTER_PLUS_EXPR, ptype, fold_build2_loc (input_location,
POINTER_PLUS_EXPR, ptype,
fold_convert (ptype, base), fold_convert (ptype, base),
virtual_size), virtual_size),
tf_warning_or_error); tf_warning_or_error);
@ -2510,7 +2515,7 @@ build_vec_delete_1 (tree base, tree maxindex, tree type,
body = build1 (EXIT_EXPR, void_type_node, body = build1 (EXIT_EXPR, void_type_node,
build2 (EQ_EXPR, boolean_type_node, tbase, build2 (EQ_EXPR, boolean_type_node, tbase,
fold_convert (ptype, base))); fold_convert (ptype, base)));
tmp = fold_build1 (NEGATE_EXPR, sizetype, size_exp); tmp = fold_build1_loc (input_location, NEGATE_EXPR, sizetype, size_exp);
body = build_compound_expr body = build_compound_expr
(input_location, (input_location,
body, cp_build_modify_expr (tbase, NOP_EXPR, body, cp_build_modify_expr (tbase, NOP_EXPR,
@ -2575,8 +2580,9 @@ build_vec_delete_1 (tree base, tree maxindex, tree type,
body = integer_zero_node; body = integer_zero_node;
/* Outermost wrapper: If pointer is null, punt. */ /* Outermost wrapper: If pointer is null, punt. */
body = fold_build3 (COND_EXPR, void_type_node, body = fold_build3_loc (input_location, COND_EXPR, void_type_node,
fold_build2 (NE_EXPR, boolean_type_node, base, fold_build2_loc (input_location,
NE_EXPR, boolean_type_node, base,
convert (TREE_TYPE (base), convert (TREE_TYPE (base),
integer_zero_node)), integer_zero_node)),
body, integer_zero_node); body, integer_zero_node);
@ -3279,7 +3285,8 @@ build_vec_delete (tree base, tree maxindex,
base = TARGET_EXPR_SLOT (base_init); base = TARGET_EXPR_SLOT (base_init);
} }
type = strip_array_types (TREE_TYPE (type)); type = strip_array_types (TREE_TYPE (type));
cookie_addr = fold_build1 (NEGATE_EXPR, sizetype, TYPE_SIZE_UNIT (sizetype)); cookie_addr = fold_build1_loc (input_location, NEGATE_EXPR,
sizetype, TYPE_SIZE_UNIT (sizetype));
cookie_addr = build2 (POINTER_PLUS_EXPR, cookie_addr = build2 (POINTER_PLUS_EXPR,
size_ptr_type, size_ptr_type,
fold_convert (size_ptr_type, base), fold_convert (size_ptr_type, base),

View File

@ -1264,16 +1264,16 @@ write_integer_cst (const tree cst)
if (sign < 0) if (sign < 0)
{ {
write_char ('n'); write_char ('n');
n = fold_build1 (NEGATE_EXPR, type, n); n = fold_build1_loc (input_location, NEGATE_EXPR, type, n);
} }
do do
{ {
tree d = fold_build2 (FLOOR_DIV_EXPR, type, n, base); tree d = fold_build2_loc (input_location, FLOOR_DIV_EXPR, type, n, base);
tree tmp = fold_build2 (MULT_EXPR, type, d, base); tree tmp = fold_build2_loc (input_location, MULT_EXPR, type, d, base);
unsigned c; unsigned c;
done = integer_zerop (d); done = integer_zerop (d);
tmp = fold_build2 (MINUS_EXPR, type, n, tmp); tmp = fold_build2_loc (input_location, MINUS_EXPR, type, n, tmp);
c = hwint_to_ascii (TREE_INT_CST_LOW (tmp), 10, ptr, c = hwint_to_ascii (TREE_INT_CST_LOW (tmp), 10, ptr,
done ? 1 : chunk_digits); done ? 1 : chunk_digits);
ptr -= c; ptr -= c;

View File

@ -221,7 +221,8 @@ thunk_adjust (tree ptr, bool this_adjusting,
{ {
if (this_adjusting) if (this_adjusting)
/* Adjust the pointer by the constant. */ /* Adjust the pointer by the constant. */
ptr = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (ptr), ptr, ptr = fold_build2_loc (input_location,
POINTER_PLUS_EXPR, TREE_TYPE (ptr), ptr,
size_int (fixed_offset)); size_int (fixed_offset));
/* If there's a virtual offset, look up that value in the vtable and /* If there's a virtual offset, look up that value in the vtable and
@ -239,18 +240,21 @@ thunk_adjust (tree ptr, bool this_adjusting,
/* Form the vtable address. */ /* Form the vtable address. */
vtable = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (vtable)), vtable); vtable = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (vtable)), vtable);
/* Find the entry with the vcall offset. */ /* Find the entry with the vcall offset. */
vtable = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (vtable), vtable, vtable = fold_build2_loc (input_location,
fold_convert (sizetype, virtual_offset)); POINTER_PLUS_EXPR, TREE_TYPE (vtable), vtable,
fold_convert (sizetype, virtual_offset));
/* Get the offset itself. */ /* Get the offset itself. */
vtable = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (vtable)), vtable); vtable = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (vtable)), vtable);
/* Adjust the `this' pointer. */ /* Adjust the `this' pointer. */
ptr = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (ptr), ptr, ptr = fold_build2_loc (input_location,
POINTER_PLUS_EXPR, TREE_TYPE (ptr), ptr,
fold_convert (sizetype, vtable)); fold_convert (sizetype, vtable));
} }
if (!this_adjusting) if (!this_adjusting)
/* Adjust the pointer by the constant. */ /* Adjust the pointer by the constant. */
ptr = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (ptr), ptr, ptr = fold_build2_loc (input_location,
POINTER_PLUS_EXPR, TREE_TYPE (ptr), ptr,
size_int (fixed_offset)); size_int (fixed_offset));
return ptr; return ptr;

View File

@ -9850,7 +9850,8 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
if (e1 == error_mark_node || e2 == error_mark_node) if (e1 == error_mark_node || e2 == error_mark_node)
return error_mark_node; return error_mark_node;
return fold_build2 (TREE_CODE (t), TREE_TYPE (t), e1, e2); return fold_build2_loc (input_location,
TREE_CODE (t), TREE_TYPE (t), e1, e2);
} }
case NEGATE_EXPR: case NEGATE_EXPR:
@ -9860,7 +9861,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
if (e == error_mark_node) if (e == error_mark_node)
return error_mark_node; return error_mark_node;
return fold_build1 (TREE_CODE (t), TREE_TYPE (t), e); return fold_build1_loc (input_location, TREE_CODE (t), TREE_TYPE (t), e);
} }
case TYPENAME_TYPE: case TYPENAME_TYPE:
@ -14073,12 +14074,12 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict)
/* If only one of the bounds used a MINUS_EXPR, compensate /* If only one of the bounds used a MINUS_EXPR, compensate
by adding one to the other bound. */ by adding one to the other bound. */
if (parm_cst && !arg_cst) if (parm_cst && !arg_cst)
parm_max = fold_build2 (PLUS_EXPR, parm_max = fold_build2_loc (input_location, PLUS_EXPR,
integer_type_node, integer_type_node,
parm_max, parm_max,
integer_one_node); integer_one_node);
else if (arg_cst && !parm_cst) else if (arg_cst && !parm_cst)
arg_max = fold_build2 (PLUS_EXPR, arg_max = fold_build2_loc (input_location, PLUS_EXPR,
integer_type_node, integer_type_node,
arg_max, arg_max,
integer_one_node); integer_one_node);

View File

@ -1099,9 +1099,11 @@ get_pseudo_ti_init (tree type, unsigned tk_index)
/* Combine offset and flags into one field. */ /* Combine offset and flags into one field. */
offset = fold_convert (offset_type, offset); offset = fold_convert (offset_type, offset);
offset = fold_build2 (LSHIFT_EXPR, offset_type, offset, offset = fold_build2_loc (input_location,
LSHIFT_EXPR, offset_type, offset,
build_int_cst (offset_type, 8)); build_int_cst (offset_type, 8));
offset = fold_build2 (BIT_IOR_EXPR, offset_type, offset, offset = fold_build2_loc (input_location,
BIT_IOR_EXPR, offset_type, offset,
build_int_cst (offset_type, flags)); build_int_cst (offset_type, flags));
base_init = tree_cons (NULL_TREE, offset, base_init); base_init = tree_cons (NULL_TREE, offset, base_init);
base_init = tree_cons (NULL_TREE, tinfo, base_init); base_init = tree_cons (NULL_TREE, tinfo, base_init);

View File

@ -3129,10 +3129,11 @@ simplify_aggr_init_expr (tree *tp)
style = arg; style = arg;
} }
call_expr = build_call_array (TREE_TYPE (TREE_TYPE (TREE_TYPE (fn))), call_expr = build_call_array_loc (input_location,
fn, TREE_TYPE (TREE_TYPE (TREE_TYPE (fn))),
aggr_init_expr_nargs (aggr_init_expr), fn,
AGGR_INIT_EXPR_ARGP (aggr_init_expr)); aggr_init_expr_nargs (aggr_init_expr),
AGGR_INIT_EXPR_ARGP (aggr_init_expr));
if (style == ctor) if (style == ctor)
{ {

View File

@ -1595,7 +1595,8 @@ cxx_print_statistics (void)
tree tree
array_type_nelts_top (tree type) array_type_nelts_top (tree type)
{ {
return fold_build2 (PLUS_EXPR, sizetype, return fold_build2_loc (input_location,
PLUS_EXPR, sizetype,
array_type_nelts (type), array_type_nelts (type),
size_one_node); size_one_node);
} }
@ -1612,7 +1613,8 @@ array_type_nelts_total (tree type)
while (TREE_CODE (type) == ARRAY_TYPE) while (TREE_CODE (type) == ARRAY_TYPE)
{ {
tree n = array_type_nelts_top (type); tree n = array_type_nelts_top (type);
sz = fold_build2 (MULT_EXPR, sizetype, sz, n); sz = fold_build2_loc (input_location,
MULT_EXPR, sizetype, sz, n);
type = TREE_TYPE (type); type = TREE_TYPE (type);
} }
return sz; return sz;

View File

@ -2429,7 +2429,8 @@ build_ptrmemfunc_access_expr (tree ptrmem, tree member_name)
/*want_type=*/false); /*want_type=*/false);
member_type = cp_build_qualified_type (TREE_TYPE (member), member_type = cp_build_qualified_type (TREE_TYPE (member),
cp_type_quals (ptrmem_type)); cp_type_quals (ptrmem_type));
return fold_build3 (COMPONENT_REF, member_type, return fold_build3_loc (input_location,
COMPONENT_REF, member_type,
ptrmem, member, NULL_TREE); ptrmem, member, NULL_TREE);
} }
@ -2836,7 +2837,8 @@ get_member_function_from_ptrfunc (tree *instance_ptrptr, tree function)
TREE_NO_WARNING (vtbl) = 1; TREE_NO_WARNING (vtbl) = 1;
/* Finally, extract the function pointer from the vtable. */ /* Finally, extract the function pointer from the vtable. */
e2 = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (vtbl), vtbl, e2 = fold_build2_loc (input_location,
POINTER_PLUS_EXPR, TREE_TYPE (vtbl), vtbl,
fold_convert (sizetype, idx)); fold_convert (sizetype, idx));
e2 = cp_build_indirect_ref (e2, NULL, tf_warning_or_error); e2 = cp_build_indirect_ref (e2, NULL, tf_warning_or_error);
TREE_CONSTANT (e2) = 1; TREE_CONSTANT (e2) = 1;
@ -4095,7 +4097,7 @@ cp_pointer_int_sum (enum tree_code resultcode, tree ptrop, tree intop)
pointer_int_sum() anyway. */ pointer_int_sum() anyway. */
complete_type (TREE_TYPE (res_type)); complete_type (TREE_TYPE (res_type));
return pointer_int_sum (resultcode, ptrop, return pointer_int_sum (input_location, resultcode, ptrop,
fold_if_not_in_template (intop)); fold_if_not_in_template (intop));
} }
@ -4393,7 +4395,7 @@ cp_build_unary_op (enum tree_code code, tree xarg, int noconvert,
case TRUTH_NOT_EXPR: case TRUTH_NOT_EXPR:
arg = perform_implicit_conversion (boolean_type_node, arg, arg = perform_implicit_conversion (boolean_type_node, arg,
complain); complain);
val = invert_truthvalue (arg); val = invert_truthvalue_loc (input_location, arg);
if (arg != error_mark_node) if (arg != error_mark_node)
return val; return val;
errstring = "in argument to unary !"; errstring = "in argument to unary !";
@ -5201,7 +5203,8 @@ convert_ptrmem (tree type, tree expr, bool allow_inverse_p,
PLUS_EXPR, op1, delta, PLUS_EXPR, op1, delta,
tf_warning_or_error); tf_warning_or_error);
expr = fold_build3 (COND_EXPR, ptrdiff_type_node, cond, op1, op2); expr = fold_build3_loc (input_location,
COND_EXPR, ptrdiff_type_node, cond, op1, op2);
} }
@ -6384,7 +6387,8 @@ get_delta_difference (tree from, tree to,
result = get_delta_difference_1 (to, from, c_cast_p); result = get_delta_difference_1 (to, from, c_cast_p);
if (result) if (result)
result = size_diffop (size_zero_node, result); result = size_diffop_loc (input_location,
size_zero_node, result);
else else
{ {
error_not_base_type (from, to); error_not_base_type (from, to);

View File

@ -4486,6 +4486,7 @@ store_expr (tree exp, rtx target, int call_param_p, bool nontemporal)
rtx temp; rtx temp;
rtx alt_rtl = NULL_RTX; rtx alt_rtl = NULL_RTX;
int dont_return_target = 0; int dont_return_target = 0;
location_t loc = EXPR_LOCATION (exp);
if (VOID_TYPE_P (TREE_TYPE (exp))) if (VOID_TYPE_P (TREE_TYPE (exp)))
{ {
@ -4561,13 +4562,13 @@ store_expr (tree exp, rtx target, int call_param_p, bool nontemporal)
(TYPE_MODE (TREE_TYPE (exp)), (TYPE_MODE (TREE_TYPE (exp)),
SUBREG_PROMOTED_UNSIGNED_P (target)); SUBREG_PROMOTED_UNSIGNED_P (target));
exp = fold_convert (ntype, exp); exp = fold_convert_loc (loc, ntype, exp);
} }
exp = fold_convert (lang_hooks.types.type_for_mode exp = fold_convert_loc (loc, lang_hooks.types.type_for_mode
(GET_MODE (SUBREG_REG (target)), (GET_MODE (SUBREG_REG (target)),
SUBREG_PROMOTED_UNSIGNED_P (target)), SUBREG_PROMOTED_UNSIGNED_P (target)),
exp); exp);
inner_target = SUBREG_REG (target); inner_target = SUBREG_REG (target);
} }
@ -4741,9 +4742,9 @@ store_expr (tree exp, rtx target, int call_param_p, bool nontemporal)
{ {
/* Compute the size of the data to copy from the string. */ /* Compute the size of the data to copy from the string. */
tree copy_size tree copy_size
= size_binop (MIN_EXPR, = size_binop_loc (loc, MIN_EXPR,
make_tree (sizetype, size), make_tree (sizetype, size),
size_int (TREE_STRING_LENGTH (exp))); size_int (TREE_STRING_LENGTH (exp)));
rtx copy_size_rtx rtx copy_size_rtx
= expand_expr (copy_size, NULL_RTX, VOIDmode, = expand_expr (copy_size, NULL_RTX, VOIDmode,
(call_param_p (call_param_p
@ -6171,6 +6172,7 @@ array_ref_element_size (tree exp)
{ {
tree aligned_size = TREE_OPERAND (exp, 3); tree aligned_size = TREE_OPERAND (exp, 3);
tree elmt_type = TREE_TYPE (TREE_TYPE (TREE_OPERAND (exp, 0))); tree elmt_type = TREE_TYPE (TREE_TYPE (TREE_OPERAND (exp, 0)));
location_t loc = EXPR_LOCATION (exp);
/* If a size was specified in the ARRAY_REF, it's the size measured /* If a size was specified in the ARRAY_REF, it's the size measured
in alignment units of the element type. So multiply by that value. */ in alignment units of the element type. So multiply by that value. */
@ -6179,9 +6181,9 @@ array_ref_element_size (tree exp)
/* ??? tree_ssa_useless_type_conversion will eliminate casts to /* ??? tree_ssa_useless_type_conversion will eliminate casts to
sizetype from another type of the same width and signedness. */ sizetype from another type of the same width and signedness. */
if (TREE_TYPE (aligned_size) != sizetype) if (TREE_TYPE (aligned_size) != sizetype)
aligned_size = fold_convert (sizetype, aligned_size); aligned_size = fold_convert_loc (loc, sizetype, aligned_size);
return size_binop (MULT_EXPR, aligned_size, return size_binop_loc (loc, MULT_EXPR, aligned_size,
size_int (TYPE_ALIGN_UNIT (elmt_type))); size_int (TYPE_ALIGN_UNIT (elmt_type)));
} }
/* Otherwise, take the size from that of the element type. Substitute /* Otherwise, take the size from that of the element type. Substitute
@ -6236,6 +6238,7 @@ component_ref_field_offset (tree exp)
{ {
tree aligned_offset = TREE_OPERAND (exp, 2); tree aligned_offset = TREE_OPERAND (exp, 2);
tree field = TREE_OPERAND (exp, 1); tree field = TREE_OPERAND (exp, 1);
location_t loc = EXPR_LOCATION (exp);
/* If an offset was specified in the COMPONENT_REF, it's the offset measured /* If an offset was specified in the COMPONENT_REF, it's the offset measured
in units of DECL_OFFSET_ALIGN / BITS_PER_UNIT. So multiply by that in units of DECL_OFFSET_ALIGN / BITS_PER_UNIT. So multiply by that
@ -6245,9 +6248,10 @@ component_ref_field_offset (tree exp)
/* ??? tree_ssa_useless_type_conversion will eliminate casts to /* ??? tree_ssa_useless_type_conversion will eliminate casts to
sizetype from another type of the same width and signedness. */ sizetype from another type of the same width and signedness. */
if (TREE_TYPE (aligned_offset) != sizetype) if (TREE_TYPE (aligned_offset) != sizetype)
aligned_offset = fold_convert (sizetype, aligned_offset); aligned_offset = fold_convert_loc (loc, sizetype, aligned_offset);
return size_binop (MULT_EXPR, aligned_offset, return size_binop_loc (loc, MULT_EXPR, aligned_offset,
size_int (DECL_OFFSET_ALIGN (field) / BITS_PER_UNIT)); size_int (DECL_OFFSET_ALIGN (field)
/ BITS_PER_UNIT));
} }
/* Otherwise, take the offset from that of the field. Substitute /* Otherwise, take the offset from that of the field. Substitute
@ -6755,7 +6759,7 @@ emutls_var_address (tree var)
tree fn = built_in_decls [BUILT_IN_EMUTLS_GET_ADDRESS]; tree fn = built_in_decls [BUILT_IN_EMUTLS_GET_ADDRESS];
tree arg = build_fold_addr_expr_with_type (emuvar, ptr_type_node); tree arg = build_fold_addr_expr_with_type (emuvar, ptr_type_node);
tree arglist = build_tree_list (NULL_TREE, arg); tree arglist = build_tree_list (NULL_TREE, arg);
tree call = build_function_call_expr (fn, arglist); tree call = build_function_call_expr (UNKNOWN_LOCATION, fn, arglist);
return fold_convert (build_pointer_type (TREE_TYPE (var)), call); return fold_convert (build_pointer_type (TREE_TYPE (var)), call);
} }
@ -7221,6 +7225,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
bool reduce_bit_field; bool reduce_bit_field;
gimple subexp0_def, subexp1_def; gimple subexp0_def, subexp1_def;
tree top0, top1; tree top0, top1;
location_t loc = EXPR_LOCATION (exp);
#define REDUCE_BIT_FIELD(expr) (reduce_bit_field \ #define REDUCE_BIT_FIELD(expr) (reduce_bit_field \
? reduce_to_bit_field_precision ((expr), \ ? reduce_to_bit_field_precision ((expr), \
target, \ target, \
@ -7347,7 +7352,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
&& TREE_CODE (exp) == VAR_DECL && TREE_CODE (exp) == VAR_DECL
&& DECL_THREAD_LOCAL_P (exp)) && DECL_THREAD_LOCAL_P (exp))
{ {
exp = build_fold_indirect_ref (emutls_var_address (exp)); exp = build_fold_indirect_ref_loc (loc, emutls_var_address (exp));
return expand_expr_real_1 (exp, target, tmode, modifier, NULL); return expand_expr_real_1 (exp, target, tmode, modifier, NULL);
} }
@ -7457,7 +7462,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
{ {
tree type_for_mode = lang_hooks.types.type_for_mode (mode, 1); tree type_for_mode = lang_hooks.types.type_for_mode (mode, 1);
if (type_for_mode) if (type_for_mode)
tmp = fold_unary (VIEW_CONVERT_EXPR, type_for_mode, exp); tmp = fold_unary_loc (loc, VIEW_CONVERT_EXPR, type_for_mode, exp);
} }
if (!tmp) if (!tmp)
tmp = build_constructor_from_list (type, tmp = build_constructor_from_list (type,
@ -7738,7 +7743,8 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
{ {
tree index1 = index; tree index1 = index;
tree low_bound = array_ref_low_bound (exp); tree low_bound = array_ref_low_bound (exp);
index1 = fold_convert (sizetype, TREE_OPERAND (exp, 1)); index1 = fold_convert_loc (loc, sizetype,
TREE_OPERAND (exp, 1));
/* Optimize the special-case of a zero lower bound. /* Optimize the special-case of a zero lower bound.
@ -7749,8 +7755,9 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
+INDEX), which becomes (ARRAY+255+INDEX). Opps!) */ +INDEX), which becomes (ARRAY+255+INDEX). Opps!) */
if (! integer_zerop (low_bound)) if (! integer_zerop (low_bound))
index1 = size_diffop (index1, fold_convert (sizetype, index1 = size_diffop_loc (loc, index1,
low_bound)); fold_convert_loc (loc, sizetype,
low_bound));
if (0 > compare_tree_int (index1, if (0 > compare_tree_int (index1,
TREE_STRING_LENGTH (init))) TREE_STRING_LENGTH (init)))
@ -8403,11 +8410,12 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
/* Make sure to sign-extend the sizetype offset in a POINTER_PLUS_EXPR /* Make sure to sign-extend the sizetype offset in a POINTER_PLUS_EXPR
if sizetype precision is smaller than pointer precision. */ if sizetype precision is smaller than pointer precision. */
if (TYPE_PRECISION (sizetype) < TYPE_PRECISION (type)) if (TYPE_PRECISION (sizetype) < TYPE_PRECISION (type))
exp = build2 (PLUS_EXPR, type, exp
TREE_OPERAND (exp, 0), = build2 (PLUS_EXPR, type,
fold_convert (type, TREE_OPERAND (exp, 0),
fold_convert (ssizetype, fold_convert_loc (loc, type,
TREE_OPERAND (exp, 1)))); fold_convert_loc (loc, ssizetype,
TREE_OPERAND (exp, 1))));
case PLUS_EXPR: case PLUS_EXPR:
/* Check if this is a case for multiplication and addition. */ /* Check if this is a case for multiplication and addition. */
@ -9738,6 +9746,7 @@ do_store_flag (tree exp, rtx target, enum machine_mode mode)
int unsignedp; int unsignedp;
rtx op0, op1; rtx op0, op1;
rtx subtarget = target; rtx subtarget = target;
location_t loc = EXPR_LOCATION (exp);
arg0 = TREE_OPERAND (exp, 0); arg0 = TREE_OPERAND (exp, 0);
arg1 = TREE_OPERAND (exp, 1); arg1 = TREE_OPERAND (exp, 1);
@ -9862,7 +9871,8 @@ do_store_flag (tree exp, rtx target, enum machine_mode mode)
&& integer_pow2p (TREE_OPERAND (arg0, 1))) && integer_pow2p (TREE_OPERAND (arg0, 1)))
{ {
tree type = lang_hooks.types.type_for_mode (mode, unsignedp); tree type = lang_hooks.types.type_for_mode (mode, unsignedp);
return expand_expr (fold_single_bit_test (code == NE ? NE_EXPR : EQ_EXPR, return expand_expr (fold_single_bit_test (loc,
code == NE ? NE_EXPR : EQ_EXPR,
arg0, arg1, type), arg0, arg1, type),
target, VOIDmode, EXPAND_NORMAL); target, VOIDmode, EXPAND_NORMAL);
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,21 @@
2009-07-17 Aldy Hernandez <aldyh@redhat.com>
Manuel López-Ibáñez <manu@gcc.gnu.org>
PR 40435
* trans-expr.c, trans-array.c, trans-openmp.c, trans-stmt.c,
trans.c, trans-io.c, trans-decl.c, trans-intrinsic.c: Add location
argument to fold_{unary,binary,ternary}, fold_build[123],
build_call_expr, build_size_arg, build_fold_addr_expr,
build_call_array, non_lvalue, size_diffop,
fold_build1_initializer, fold_build2_initializer,
fold_build3_initializer, fold_build_call_array,
fold_build_call_array_initializer, fold_single_bit_test,
omit_one_operand, omit_two_operands, invert_truthvalue,
fold_truth_not_expr, build_fold_indirect_ref, fold_indirect_ref,
combine_comparisons, fold_builtin_*, fold_call_expr,
build_range_check, maybe_fold_offset_to_address, round_up,
round_down.
2009-07-15 Janus Weil <janus@gcc.gnu.org> 2009-07-15 Janus Weil <janus@gcc.gnu.org>
PR fortran/40743 PR fortran/40743

View File

@ -620,11 +620,13 @@ gfc_trans_allocate_array_storage (stmtblock_t * pre, stmtblock_t * post,
gcc_assert (tmp == gfc_get_element_type (TREE_TYPE (desc))); gcc_assert (tmp == gfc_get_element_type (TREE_TYPE (desc)));
packed = gfc_create_var (build_pointer_type (tmp), "data"); packed = gfc_create_var (build_pointer_type (tmp), "data");
tmp = build_call_expr (gfor_fndecl_in_pack, 1, initial); tmp = build_call_expr_loc (input_location,
gfor_fndecl_in_pack, 1, initial);
tmp = fold_convert (TREE_TYPE (packed), tmp); tmp = fold_convert (TREE_TYPE (packed), tmp);
gfc_add_modify (pre, packed, tmp); gfc_add_modify (pre, packed, tmp);
tmp = build_fold_indirect_ref (initial); tmp = build_fold_indirect_ref_loc (input_location,
initial);
source_data = gfc_conv_descriptor_data_get (tmp); source_data = gfc_conv_descriptor_data_get (tmp);
/* internal_pack may return source->data without any allocation /* internal_pack may return source->data without any allocation
@ -1084,7 +1086,8 @@ gfc_trans_array_ctor_element (stmtblock_t * pblock, tree desc,
gfc_conv_expr (se, expr); gfc_conv_expr (se, expr);
/* Store the value. */ /* Store the value. */
tmp = build_fold_indirect_ref (gfc_conv_descriptor_data_get (desc)); tmp = build_fold_indirect_ref_loc (input_location,
gfc_conv_descriptor_data_get (desc));
tmp = gfc_build_array_ref (tmp, offset, NULL); tmp = gfc_build_array_ref (tmp, offset, NULL);
if (expr->ts.type == BT_CHARACTER) if (expr->ts.type == BT_CHARACTER)
@ -1353,14 +1356,16 @@ gfc_trans_array_constructor_value (stmtblock_t * pblock, tree type,
/* Use BUILTIN_MEMCPY to assign the values. */ /* Use BUILTIN_MEMCPY to assign the values. */
tmp = gfc_conv_descriptor_data_get (desc); tmp = gfc_conv_descriptor_data_get (desc);
tmp = build_fold_indirect_ref (tmp); tmp = build_fold_indirect_ref_loc (input_location,
tmp);
tmp = gfc_build_array_ref (tmp, *poffset, NULL); tmp = gfc_build_array_ref (tmp, *poffset, NULL);
tmp = gfc_build_addr_expr (NULL_TREE, tmp); tmp = gfc_build_addr_expr (NULL_TREE, tmp);
init = gfc_build_addr_expr (NULL_TREE, init); init = gfc_build_addr_expr (NULL_TREE, init);
size = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (type)); size = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (type));
bound = build_int_cst (NULL_TREE, n * size); bound = build_int_cst (NULL_TREE, n * size);
tmp = build_call_expr (built_in_decls[BUILT_IN_MEMCPY], 3, tmp = build_call_expr_loc (input_location,
built_in_decls[BUILT_IN_MEMCPY], 3,
tmp, init, bound); tmp, init, bound);
gfc_add_expr_to_block (&body, tmp); gfc_add_expr_to_block (&body, tmp);
@ -2408,7 +2413,8 @@ gfc_conv_array_index_offset (gfc_se * se, gfc_ss_info * info, int dim, int i,
index, gfc_conv_array_stride (desc, 0)); index, gfc_conv_array_stride (desc, 0));
/* Read the vector to get an index into info->descriptor. */ /* Read the vector to get an index into info->descriptor. */
data = build_fold_indirect_ref (gfc_conv_array_data (desc)); data = build_fold_indirect_ref_loc (input_location,
gfc_conv_array_data (desc));
index = gfc_build_array_ref (data, index, NULL); index = gfc_build_array_ref (data, index, NULL);
index = gfc_evaluate_now (index, &se->pre); index = gfc_evaluate_now (index, &se->pre);
@ -2482,7 +2488,8 @@ gfc_conv_scalarized_array_ref (gfc_se * se, gfc_array_ref * ar)
if (se->ss->expr && is_subref_array (se->ss->expr)) if (se->ss->expr && is_subref_array (se->ss->expr))
decl = se->ss->expr->symtree->n.sym->backend_decl; decl = se->ss->expr->symtree->n.sym->backend_decl;
tmp = build_fold_indirect_ref (info->data); tmp = build_fold_indirect_ref_loc (input_location,
info->data);
se->expr = gfc_build_array_ref (tmp, index, decl); se->expr = gfc_build_array_ref (tmp, index, decl);
} }
@ -4461,7 +4468,8 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body)
type = TREE_TYPE (tmpdesc); type = TREE_TYPE (tmpdesc);
gcc_assert (GFC_ARRAY_TYPE_P (type)); gcc_assert (GFC_ARRAY_TYPE_P (type));
dumdesc = GFC_DECL_SAVED_DESCRIPTOR (tmpdesc); dumdesc = GFC_DECL_SAVED_DESCRIPTOR (tmpdesc);
dumdesc = build_fold_indirect_ref (dumdesc); dumdesc = build_fold_indirect_ref_loc (input_location,
dumdesc);
gfc_start_block (&block); gfc_start_block (&block);
if (sym->ts.type == BT_CHARACTER if (sym->ts.type == BT_CHARACTER
@ -4513,7 +4521,8 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body)
gcc_assert (integer_onep (GFC_TYPE_ARRAY_STRIDE (type, 0))); gcc_assert (integer_onep (GFC_TYPE_ARRAY_STRIDE (type, 0)));
/* A library call to repack the array if necessary. */ /* A library call to repack the array if necessary. */
tmp = GFC_DECL_SAVED_DESCRIPTOR (tmpdesc); tmp = GFC_DECL_SAVED_DESCRIPTOR (tmpdesc);
stmt_unpacked = build_call_expr (gfor_fndecl_in_pack, 1, tmp); stmt_unpacked = build_call_expr_loc (input_location,
gfor_fndecl_in_pack, 1, tmp);
stride = gfc_index_one_node; stride = gfc_index_one_node;
@ -4699,7 +4708,8 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body)
if (sym->attr.intent != INTENT_IN) if (sym->attr.intent != INTENT_IN)
{ {
/* Copy the data back. */ /* Copy the data back. */
tmp = build_call_expr (gfor_fndecl_in_unpack, 2, dumdesc, tmpdesc); tmp = build_call_expr_loc (input_location,
gfor_fndecl_in_unpack, 2, dumdesc, tmpdesc);
gfc_add_expr_to_block (&cleanup, tmp); gfc_add_expr_to_block (&cleanup, tmp);
} }
@ -4710,7 +4720,8 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body)
stmt = gfc_finish_block (&cleanup); stmt = gfc_finish_block (&cleanup);
/* Only do the cleanup if the array was repacked. */ /* Only do the cleanup if the array was repacked. */
tmp = build_fold_indirect_ref (dumdesc); tmp = build_fold_indirect_ref_loc (input_location,
dumdesc);
tmp = gfc_conv_descriptor_data_get (tmp); tmp = gfc_conv_descriptor_data_get (tmp);
tmp = fold_build2 (NE_EXPR, boolean_type_node, tmp, tmpdesc); tmp = fold_build2 (NE_EXPR, boolean_type_node, tmp, tmpdesc);
stmt = build3_v (COND_EXPR, tmp, stmt, build_empty_stmt (input_location)); stmt = build3_v (COND_EXPR, tmp, stmt, build_empty_stmt (input_location));
@ -4753,7 +4764,8 @@ gfc_get_dataptr_offset (stmtblock_t *block, tree parm, tree desc, tree offset,
} }
tmp = gfc_conv_array_data (desc); tmp = gfc_conv_array_data (desc);
tmp = build_fold_indirect_ref (tmp); tmp = build_fold_indirect_ref_loc (input_location,
tmp);
tmp = gfc_build_array_ref (tmp, offset, NULL); tmp = gfc_build_array_ref (tmp, offset, NULL);
/* Offset the data pointer for pointer assignments from arrays with /* Offset the data pointer for pointer assignments from arrays with
@ -5178,7 +5190,8 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
{ {
gfc_conv_expr (&rse, expr); gfc_conv_expr (&rse, expr);
if (POINTER_TYPE_P (TREE_TYPE (rse.expr))) if (POINTER_TYPE_P (TREE_TYPE (rse.expr)))
rse.expr = build_fold_indirect_ref (rse.expr); rse.expr = build_fold_indirect_ref_loc (input_location,
rse.expr);
} }
else else
gfc_conv_expr_val (&rse, expr); gfc_conv_expr_val (&rse, expr);
@ -5408,7 +5421,8 @@ array_parameter_size (tree desc, gfc_expr *expr, tree *size)
if (GFC_ARRAY_TYPE_P (TREE_TYPE (desc))) if (GFC_ARRAY_TYPE_P (TREE_TYPE (desc)))
*size = GFC_TYPE_ARRAY_SIZE (TREE_TYPE (desc)); *size = GFC_TYPE_ARRAY_SIZE (TREE_TYPE (desc));
else if (expr->rank > 1) else if (expr->rank > 1)
*size = build_call_expr (gfor_fndecl_size0, 1, *size = build_call_expr_loc (input_location,
gfor_fndecl_size0, 1,
gfc_build_addr_expr (NULL, desc)); gfc_build_addr_expr (NULL, desc));
else else
{ {
@ -5509,7 +5523,8 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, gfc_ss * ss, int g77,
if (g77 && TREE_TYPE (TREE_TYPE (se->expr)) != NULL_TREE if (g77 && TREE_TYPE (TREE_TYPE (se->expr)) != NULL_TREE
&& GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (TREE_TYPE (se->expr)))) && GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (TREE_TYPE (se->expr))))
se->expr = gfc_conv_array_data (build_fold_indirect_ref (se->expr)); se->expr = gfc_conv_array_data (build_fold_indirect_ref_loc (input_location,
se->expr));
return; return;
} }
@ -5519,7 +5534,8 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, gfc_ss * ss, int g77,
se->want_pointer = 1; se->want_pointer = 1;
gfc_conv_expr_descriptor (se, expr, ss); gfc_conv_expr_descriptor (se, expr, ss);
if (size) if (size)
array_parameter_size (build_fold_indirect_ref (se->expr), array_parameter_size (build_fold_indirect_ref_loc (input_location,
se->expr),
expr, size); expr, size);
} }
@ -5529,7 +5545,8 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, gfc_ss * ss, int g77,
&& expr->ts.derived->attr.alloc_comp && expr->ts.derived->attr.alloc_comp
&& expr->expr_type != EXPR_VARIABLE) && expr->expr_type != EXPR_VARIABLE)
{ {
tmp = build_fold_indirect_ref (se->expr); tmp = build_fold_indirect_ref_loc (input_location,
se->expr);
tmp = gfc_deallocate_alloc_comp (expr->ts.derived, tmp, expr->rank); tmp = gfc_deallocate_alloc_comp (expr->ts.derived, tmp, expr->rank);
gfc_add_expr_to_block (&se->post, tmp); gfc_add_expr_to_block (&se->post, tmp);
} }
@ -5548,7 +5565,8 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, gfc_ss * ss, int g77,
gfc_warning ("Creating array temporary at %L", &expr->where); gfc_warning ("Creating array temporary at %L", &expr->where);
} }
ptr = build_call_expr (gfor_fndecl_in_pack, 1, desc); ptr = build_call_expr_loc (input_location,
gfor_fndecl_in_pack, 1, desc);
if (fsym && fsym->attr.optional && sym && sym->attr.optional) if (fsym && fsym->attr.optional && sym && sym->attr.optional)
{ {
@ -5572,7 +5590,8 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, gfc_ss * ss, int g77,
else else
asprintf (&msg, "An array temporary was created"); asprintf (&msg, "An array temporary was created");
tmp = build_fold_indirect_ref (desc); tmp = build_fold_indirect_ref_loc (input_location,
desc);
tmp = gfc_conv_array_data (tmp); tmp = gfc_conv_array_data (tmp);
tmp = fold_build2 (NE_EXPR, boolean_type_node, tmp = fold_build2 (NE_EXPR, boolean_type_node,
fold_convert (TREE_TYPE (tmp), ptr), tmp); fold_convert (TREE_TYPE (tmp), ptr), tmp);
@ -5591,7 +5610,8 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, gfc_ss * ss, int g77,
/* Copy the data back. */ /* Copy the data back. */
if (fsym == NULL || fsym->attr.intent != INTENT_IN) if (fsym == NULL || fsym->attr.intent != INTENT_IN)
{ {
tmp = build_call_expr (gfor_fndecl_in_unpack, 2, desc, ptr); tmp = build_call_expr_loc (input_location,
gfor_fndecl_in_unpack, 2, desc, ptr);
gfc_add_expr_to_block (&block, tmp); gfc_add_expr_to_block (&block, tmp);
} }
@ -5604,7 +5624,8 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, gfc_ss * ss, int g77,
gfc_init_block (&block); gfc_init_block (&block);
/* Only if it was repacked. This code needs to be executed before the /* Only if it was repacked. This code needs to be executed before the
loop cleanup code. */ loop cleanup code. */
tmp = build_fold_indirect_ref (desc); tmp = build_fold_indirect_ref_loc (input_location,
desc);
tmp = gfc_conv_array_data (tmp); tmp = gfc_conv_array_data (tmp);
tmp = fold_build2 (NE_EXPR, boolean_type_node, tmp = fold_build2 (NE_EXPR, boolean_type_node,
fold_convert (TREE_TYPE (tmp), ptr), tmp); fold_convert (TREE_TYPE (tmp), ptr), tmp);
@ -5707,7 +5728,8 @@ gfc_duplicate_allocatable(tree dest, tree src, tree type, int rank)
/* We know the temporary and the value will be the same length, /* We know the temporary and the value will be the same length,
so can use memcpy. */ so can use memcpy. */
tmp = built_in_decls[BUILT_IN_MEMCPY]; tmp = built_in_decls[BUILT_IN_MEMCPY];
tmp = build_call_expr (tmp, 3, gfc_conv_descriptor_data_get (dest), tmp = build_call_expr_loc (input_location,
tmp, 3, gfc_conv_descriptor_data_get (dest),
gfc_conv_descriptor_data_get (src), size); gfc_conv_descriptor_data_get (src), size);
gfc_add_expr_to_block (&block, tmp); gfc_add_expr_to_block (&block, tmp);
tmp = gfc_finish_block (&block); tmp = gfc_finish_block (&block);
@ -5750,7 +5772,8 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
gfc_init_block (&fnblock); gfc_init_block (&fnblock);
if (POINTER_TYPE_P (TREE_TYPE (decl))) if (POINTER_TYPE_P (TREE_TYPE (decl)))
decl = build_fold_indirect_ref (decl); decl = build_fold_indirect_ref_loc (input_location,
decl);
/* If this an array of derived types with allocatable components /* If this an array of derived types with allocatable components
build a loop and recursively call this function. */ build a loop and recursively call this function. */
@ -5758,7 +5781,8 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
|| GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (decl))) || GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (decl)))
{ {
tmp = gfc_conv_array_data (decl); tmp = gfc_conv_array_data (decl);
var = build_fold_indirect_ref (tmp); var = build_fold_indirect_ref_loc (input_location,
tmp);
/* Get the number of elements - 1 and set the counter. */ /* Get the number of elements - 1 and set the counter. */
if (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (decl))) if (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (decl)))
@ -5797,7 +5821,8 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
tmp = gfc_duplicate_allocatable (dest, decl, TREE_TYPE(decl), rank); tmp = gfc_duplicate_allocatable (dest, decl, TREE_TYPE(decl), rank);
gfc_add_expr_to_block (&fnblock, tmp); gfc_add_expr_to_block (&fnblock, tmp);
} }
tmp = build_fold_indirect_ref (gfc_conv_array_data (dest)); tmp = build_fold_indirect_ref_loc (input_location,
gfc_conv_array_data (dest));
dref = gfc_build_array_ref (tmp, index, NULL); dref = gfc_build_array_ref (tmp, index, NULL);
tmp = structure_alloc_comps (der_type, vref, dref, rank, purpose); tmp = structure_alloc_comps (der_type, vref, dref, rank, purpose);
} }
@ -6022,7 +6047,8 @@ gfc_trans_deferred_array (gfc_symbol * sym, tree body)
{ {
/* If the backend_decl is not a descriptor, we must have a pointer /* If the backend_decl is not a descriptor, we must have a pointer
to one. */ to one. */
descriptor = build_fold_indirect_ref (sym->backend_decl); descriptor = build_fold_indirect_ref_loc (input_location,
sym->backend_decl);
type = TREE_TYPE (descriptor); type = TREE_TYPE (descriptor);
} }

View File

@ -408,7 +408,8 @@ gfc_finish_cray_pointee (tree decl, gfc_symbol *sym)
/* Parameters need to be dereferenced. */ /* Parameters need to be dereferenced. */
if (sym->cp_pointer->attr.dummy) if (sym->cp_pointer->attr.dummy)
ptr_decl = build_fold_indirect_ref (ptr_decl); ptr_decl = build_fold_indirect_ref_loc (input_location,
ptr_decl);
/* Check to see if we're dealing with a variable-sized array. */ /* Check to see if we're dealing with a variable-sized array. */
if (sym->attr.dimension if (sym->attr.dimension
@ -422,7 +423,8 @@ gfc_finish_cray_pointee (tree decl, gfc_symbol *sym)
{ {
ptr_decl = convert (build_pointer_type (TREE_TYPE (decl)), ptr_decl = convert (build_pointer_type (TREE_TYPE (decl)),
ptr_decl); ptr_decl);
value = build_fold_indirect_ref (ptr_decl); value = build_fold_indirect_ref_loc (input_location,
ptr_decl);
} }
SET_DECL_VALUE_EXPR (decl, value); SET_DECL_VALUE_EXPR (decl, value);
@ -1991,7 +1993,7 @@ build_entry_thunks (gfc_namespace * ns)
args = nreverse (args); args = nreverse (args);
args = chainon (args, nreverse (string_args)); args = chainon (args, nreverse (string_args));
tmp = ns->proc_name->backend_decl; tmp = ns->proc_name->backend_decl;
tmp = build_function_call_expr (tmp, args); tmp = build_function_call_expr (input_location, tmp, args);
if (ns->proc_name->attr.mixed_entry_master) if (ns->proc_name->attr.mixed_entry_master)
{ {
tree union_decl, field; tree union_decl, field;
@ -4012,7 +4014,8 @@ create_main_function (tree fndecl)
/* Call _gfortran_set_args (argc, argv). */ /* Call _gfortran_set_args (argc, argv). */
TREE_USED (argc) = 1; TREE_USED (argc) = 1;
TREE_USED (argv) = 1; TREE_USED (argv) = 1;
tmp = build_call_expr (gfor_fndecl_set_args, 2, argc, argv); tmp = build_call_expr_loc (input_location,
gfor_fndecl_set_args, 2, argc, argv);
gfc_add_expr_to_block (&body, tmp); gfc_add_expr_to_block (&body, tmp);
/* Add a call to set_options to set up the runtime library Fortran /* Add a call to set_options to set up the runtime library Fortran
@ -4060,7 +4063,8 @@ create_main_function (tree fndecl)
DECL_INITIAL (var) = array; DECL_INITIAL (var) = array;
var = gfc_build_addr_expr (build_pointer_type (integer_type_node), var); var = gfc_build_addr_expr (build_pointer_type (integer_type_node), var);
tmp = build_call_expr (gfor_fndecl_set_options, 2, tmp = build_call_expr_loc (input_location,
gfor_fndecl_set_options, 2,
build_int_cst (integer_type_node, 8), var); build_int_cst (integer_type_node, 8), var);
gfc_add_expr_to_block (&body, tmp); gfc_add_expr_to_block (&body, tmp);
} }
@ -4069,7 +4073,8 @@ create_main_function (tree fndecl)
the library will raise a FPE when needed. */ the library will raise a FPE when needed. */
if (gfc_option.fpe != 0) if (gfc_option.fpe != 0)
{ {
tmp = build_call_expr (gfor_fndecl_set_fpe, 1, tmp = build_call_expr_loc (input_location,
gfor_fndecl_set_fpe, 1,
build_int_cst (integer_type_node, build_int_cst (integer_type_node,
gfc_option.fpe)); gfc_option.fpe));
gfc_add_expr_to_block (&body, tmp); gfc_add_expr_to_block (&body, tmp);
@ -4080,7 +4085,8 @@ create_main_function (tree fndecl)
if (gfc_option.convert != GFC_CONVERT_NATIVE) if (gfc_option.convert != GFC_CONVERT_NATIVE)
{ {
tmp = build_call_expr (gfor_fndecl_set_convert, 1, tmp = build_call_expr_loc (input_location,
gfor_fndecl_set_convert, 1,
build_int_cst (integer_type_node, build_int_cst (integer_type_node,
gfc_option.convert)); gfc_option.convert));
gfc_add_expr_to_block (&body, tmp); gfc_add_expr_to_block (&body, tmp);
@ -4091,7 +4097,8 @@ create_main_function (tree fndecl)
if (gfc_option.record_marker != 0) if (gfc_option.record_marker != 0)
{ {
tmp = build_call_expr (gfor_fndecl_set_record_marker, 1, tmp = build_call_expr_loc (input_location,
gfor_fndecl_set_record_marker, 1,
build_int_cst (integer_type_node, build_int_cst (integer_type_node,
gfc_option.record_marker)); gfc_option.record_marker));
gfc_add_expr_to_block (&body, tmp); gfc_add_expr_to_block (&body, tmp);
@ -4099,14 +4106,16 @@ create_main_function (tree fndecl)
if (gfc_option.max_subrecord_length != 0) if (gfc_option.max_subrecord_length != 0)
{ {
tmp = build_call_expr (gfor_fndecl_set_max_subrecord_length, 1, tmp = build_call_expr_loc (input_location,
gfor_fndecl_set_max_subrecord_length, 1,
build_int_cst (integer_type_node, build_int_cst (integer_type_node,
gfc_option.max_subrecord_length)); gfc_option.max_subrecord_length));
gfc_add_expr_to_block (&body, tmp); gfc_add_expr_to_block (&body, tmp);
} }
/* Call MAIN__(). */ /* Call MAIN__(). */
tmp = build_call_expr (fndecl, 0); tmp = build_call_expr_loc (input_location,
fndecl, 0);
gfc_add_expr_to_block (&body, tmp); gfc_add_expr_to_block (&body, tmp);
/* Mark MAIN__ as used. */ /* Mark MAIN__ as used. */
@ -4461,7 +4470,8 @@ gfc_generate_constructors (void)
for (; gfc_static_ctors; gfc_static_ctors = TREE_CHAIN (gfc_static_ctors)) for (; gfc_static_ctors; gfc_static_ctors = TREE_CHAIN (gfc_static_ctors))
{ {
tmp = build_call_expr (TREE_VALUE (gfc_static_ctors), 0); tmp = build_call_expr_loc (input_location,
TREE_VALUE (gfc_static_ctors), 0);
DECL_SAVED_TREE (fndecl) = build_stmt (input_location, EXPR_STMT, tmp); DECL_SAVED_TREE (fndecl) = build_stmt (input_location, EXPR_STMT, tmp);
} }

View File

@ -158,7 +158,8 @@ gfc_conv_missing_dummy (gfc_se * se, gfc_expr * arg, gfc_typespec ts, int kind)
{ {
/* Create a temporary and convert it to the correct type. */ /* Create a temporary and convert it to the correct type. */
tmp = gfc_get_int_type (kind); tmp = gfc_get_int_type (kind);
tmp = fold_convert (tmp, build_fold_indirect_ref (se->expr)); tmp = fold_convert (tmp, build_fold_indirect_ref_loc (input_location,
se->expr));
/* Test for a NULL value. */ /* Test for a NULL value. */
tmp = build3 (COND_EXPR, TREE_TYPE (tmp), present, tmp, tmp = build3 (COND_EXPR, TREE_TYPE (tmp), present, tmp,
@ -381,7 +382,8 @@ gfc_conv_substring (gfc_se * se, gfc_ref * ref, int kind,
if (TYPE_STRING_FLAG (TREE_TYPE (se->expr))) if (TYPE_STRING_FLAG (TREE_TYPE (se->expr)))
tmp = se->expr; tmp = se->expr;
else else
tmp = build_fold_indirect_ref (se->expr); tmp = build_fold_indirect_ref_loc (input_location,
se->expr);
tmp = gfc_build_array_ref (tmp, start.expr, NULL); tmp = gfc_build_array_ref (tmp, start.expr, NULL);
se->expr = gfc_build_addr_expr (type, tmp); se->expr = gfc_build_addr_expr (type, tmp);
} }
@ -478,7 +480,8 @@ gfc_conv_component_ref (gfc_se * se, gfc_ref * ref)
if ((c->attr.pointer && c->attr.dimension == 0 && c->ts.type != BT_CHARACTER) if ((c->attr.pointer && c->attr.dimension == 0 && c->ts.type != BT_CHARACTER)
|| c->attr.proc_pointer) || c->attr.proc_pointer)
se->expr = build_fold_indirect_ref (se->expr); se->expr = build_fold_indirect_ref_loc (input_location,
se->expr);
} }
@ -621,21 +624,24 @@ gfc_conv_variable (gfc_se * se, gfc_expr * expr)
&& (sym->attr.dummy && (sym->attr.dummy
|| sym->attr.function || sym->attr.function
|| sym->attr.result)) || sym->attr.result))
se->expr = build_fold_indirect_ref (se->expr); se->expr = build_fold_indirect_ref_loc (input_location,
se->expr);
} }
else if (!sym->attr.value) else if (!sym->attr.value)
{ {
/* Dereference non-character scalar dummy arguments. */ /* Dereference non-character scalar dummy arguments. */
if (sym->attr.dummy && !sym->attr.dimension) if (sym->attr.dummy && !sym->attr.dimension)
se->expr = build_fold_indirect_ref (se->expr); se->expr = build_fold_indirect_ref_loc (input_location,
se->expr);
/* Dereference scalar hidden result. */ /* Dereference scalar hidden result. */
if (gfc_option.flag_f2c && sym->ts.type == BT_COMPLEX if (gfc_option.flag_f2c && sym->ts.type == BT_COMPLEX
&& (sym->attr.function || sym->attr.result) && (sym->attr.function || sym->attr.result)
&& !sym->attr.dimension && !sym->attr.pointer && !sym->attr.dimension && !sym->attr.pointer
&& !sym->attr.always_explicit) && !sym->attr.always_explicit)
se->expr = build_fold_indirect_ref (se->expr); se->expr = build_fold_indirect_ref_loc (input_location,
se->expr);
/* Dereference non-character pointer variables. /* Dereference non-character pointer variables.
These must be dummies, results, or scalars. */ These must be dummies, results, or scalars. */
@ -644,7 +650,8 @@ gfc_conv_variable (gfc_se * se, gfc_expr * expr)
|| sym->attr.function || sym->attr.function
|| sym->attr.result || sym->attr.result
|| !sym->attr.dimension)) || !sym->attr.dimension))
se->expr = build_fold_indirect_ref (se->expr); se->expr = build_fold_indirect_ref_loc (input_location,
se->expr);
} }
ref = expr->ref; ref = expr->ref;
@ -1080,7 +1087,8 @@ gfc_conv_power_op (gfc_se * se, gfc_expr * expr)
break; break;
} }
se->expr = build_call_expr (fndecl, 2, lse.expr, rse.expr); se->expr = build_call_expr_loc (input_location,
fndecl, 2, lse.expr, rse.expr);
} }
@ -1171,7 +1179,8 @@ gfc_conv_concat_op (gfc_se * se, gfc_expr * expr)
else else
gcc_unreachable (); gcc_unreachable ();
tmp = build_call_expr (fndecl, 6, len, var, lse.string_length, lse.expr, tmp = build_call_expr_loc (input_location,
fndecl, 6, len, var, lse.string_length, lse.expr,
rse.string_length, rse.expr); rse.string_length, rse.expr);
gfc_add_expr_to_block (&se->pre, tmp); gfc_add_expr_to_block (&se->pre, tmp);
@ -1378,7 +1387,8 @@ string_to_single_character (tree len, tree str, int kind)
&& TREE_INT_CST_HIGH (len) == 0) && TREE_INT_CST_HIGH (len) == 0)
{ {
str = fold_convert (gfc_get_pchar_type (kind), str); str = fold_convert (gfc_get_pchar_type (kind), str);
return build_fold_indirect_ref (str); return build_fold_indirect_ref_loc (input_location,
str);
} }
return NULL_TREE; return NULL_TREE;
@ -1481,7 +1491,8 @@ gfc_build_compare_string (tree len1, tree str1, tree len2, tree str2, int kind)
else else
gcc_unreachable (); gcc_unreachable ();
tmp = build_call_expr (fndecl, 4, len1, str1, len2, str2); tmp = build_call_expr_loc (input_location,
fndecl, 4, len1, str1, len2, str2);
} }
return tmp; return tmp;
@ -1498,7 +1509,8 @@ conv_function_val (gfc_se * se, gfc_symbol * sym, gfc_expr * expr)
{ {
tmp = gfc_get_symbol_decl (sym); tmp = gfc_get_symbol_decl (sym);
if (sym->attr.proc_pointer) if (sym->attr.proc_pointer)
tmp = build_fold_indirect_ref (tmp); tmp = build_fold_indirect_ref_loc (input_location,
tmp);
gcc_assert (TREE_CODE (TREE_TYPE (tmp)) == POINTER_TYPE gcc_assert (TREE_CODE (TREE_TYPE (tmp)) == POINTER_TYPE
&& TREE_CODE (TREE_TYPE (TREE_TYPE (tmp))) == FUNCTION_TYPE); && TREE_CODE (TREE_TYPE (TREE_TYPE (tmp))) == FUNCTION_TYPE);
} }
@ -1738,7 +1750,8 @@ gfc_add_interface_mapping (gfc_interface_mapping * mapping,
tmp = gfc_get_character_type_len (sym->ts.kind, NULL); tmp = gfc_get_character_type_len (sym->ts.kind, NULL);
tmp = build_pointer_type (tmp); tmp = build_pointer_type (tmp);
if (sym->attr.pointer) if (sym->attr.pointer)
value = build_fold_indirect_ref (se->expr); value = build_fold_indirect_ref_loc (input_location,
se->expr);
else else
value = se->expr; value = se->expr;
value = fold_convert (tmp, value); value = fold_convert (tmp, value);
@ -1747,11 +1760,13 @@ gfc_add_interface_mapping (gfc_interface_mapping * mapping,
/* If the argument is a scalar, a pointer to an array or an allocatable, /* If the argument is a scalar, a pointer to an array or an allocatable,
dereference it. */ dereference it. */
else if (!sym->attr.dimension || sym->attr.pointer || sym->attr.allocatable) else if (!sym->attr.dimension || sym->attr.pointer || sym->attr.allocatable)
value = build_fold_indirect_ref (se->expr); value = build_fold_indirect_ref_loc (input_location,
se->expr);
/* For character(*), use the actual argument's descriptor. */ /* For character(*), use the actual argument's descriptor. */
else if (sym->ts.type == BT_CHARACTER && !new_sym->ts.cl->length) else if (sym->ts.type == BT_CHARACTER && !new_sym->ts.cl->length)
value = build_fold_indirect_ref (se->expr); value = build_fold_indirect_ref_loc (input_location,
se->expr);
/* If the argument is an array descriptor, use it to determine /* If the argument is an array descriptor, use it to determine
information about the actual argument's shape. */ information about the actual argument's shape. */
@ -1759,7 +1774,8 @@ gfc_add_interface_mapping (gfc_interface_mapping * mapping,
&& GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (TREE_TYPE (se->expr)))) && GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (TREE_TYPE (se->expr))))
{ {
/* Get the actual argument's descriptor. */ /* Get the actual argument's descriptor. */
desc = build_fold_indirect_ref (se->expr); desc = build_fold_indirect_ref_loc (input_location,
se->expr);
/* Create the replacement variable. */ /* Create the replacement variable. */
tmp = gfc_conv_descriptor_data_get (desc); tmp = gfc_conv_descriptor_data_get (desc);
@ -2294,7 +2310,8 @@ gfc_conv_subref_array_arg (gfc_se * parmse, gfc_expr * expr,
rse.loop->loopvar[0], offset); rse.loop->loopvar[0], offset);
/* Now use the offset for the reference. */ /* Now use the offset for the reference. */
tmp = build_fold_indirect_ref (info->data); tmp = build_fold_indirect_ref_loc (input_location,
info->data);
rse.expr = gfc_build_array_ref (tmp, tmp_index, NULL); rse.expr = gfc_build_array_ref (tmp, tmp_index, NULL);
if (expr->ts.type == BT_CHARACTER) if (expr->ts.type == BT_CHARACTER)
@ -2703,7 +2720,8 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
if (fsym && fsym->attr.allocatable if (fsym && fsym->attr.allocatable
&& fsym->attr.intent == INTENT_OUT) && fsym->attr.intent == INTENT_OUT)
{ {
tmp = build_fold_indirect_ref (parmse.expr); tmp = build_fold_indirect_ref_loc (input_location,
parmse.expr);
tmp = gfc_trans_dealloc_allocated (tmp); tmp = gfc_trans_dealloc_allocated (tmp);
gfc_add_expr_to_block (&se->pre, tmp); gfc_add_expr_to_block (&se->pre, tmp);
} }
@ -2757,7 +2775,8 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
&& (e->expr_type != EXPR_VARIABLE && !e->rank)) && (e->expr_type != EXPR_VARIABLE && !e->rank))
{ {
int parm_rank; int parm_rank;
tmp = build_fold_indirect_ref (parmse.expr); tmp = build_fold_indirect_ref_loc (input_location,
parmse.expr);
parm_rank = e->rank; parm_rank = e->rank;
switch (parm_kind) switch (parm_kind)
{ {
@ -2767,7 +2786,8 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
break; break;
case (SCALAR_POINTER): case (SCALAR_POINTER):
tmp = build_fold_indirect_ref (tmp); tmp = build_fold_indirect_ref_loc (input_location,
tmp);
break; break;
} }
@ -2948,7 +2968,8 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
&& TREE_TYPE (TREE_TYPE (TREE_TYPE (se->expr))) && TREE_TYPE (TREE_TYPE (TREE_TYPE (se->expr)))
&& GFC_DESCRIPTOR_TYPE_P && GFC_DESCRIPTOR_TYPE_P
(TREE_TYPE (TREE_TYPE (TREE_TYPE (se->expr))))) (TREE_TYPE (TREE_TYPE (TREE_TYPE (se->expr)))))
se->expr = build_fold_indirect_ref (se->expr); se->expr = build_fold_indirect_ref_loc (input_location,
se->expr);
retargs = gfc_chainon_list (retargs, se->expr); retargs = gfc_chainon_list (retargs, se->expr);
} }
@ -3076,7 +3097,8 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
where f is pointer valued, we have to dereference the result. */ where f is pointer valued, we have to dereference the result. */
if (!se->want_pointer && !byref && sym->attr.pointer if (!se->want_pointer && !byref && sym->attr.pointer
&& !gfc_is_proc_ptr_comp (expr, NULL)) && !gfc_is_proc_ptr_comp (expr, NULL))
se->expr = build_fold_indirect_ref (se->expr); se->expr = build_fold_indirect_ref_loc (input_location,
se->expr);
/* f2c calling conventions require a scalar default real function to /* f2c calling conventions require a scalar default real function to
return a double precision result. Convert this back to default return a double precision result. Convert this back to default
@ -3123,7 +3145,8 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
{ {
/* Dereference for character pointer results. */ /* Dereference for character pointer results. */
if (sym->attr.pointer || sym->attr.allocatable) if (sym->attr.pointer || sym->attr.allocatable)
se->expr = build_fold_indirect_ref (var); se->expr = build_fold_indirect_ref_loc (input_location,
var);
else else
se->expr = var; se->expr = var;
@ -3132,7 +3155,8 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
else else
{ {
gcc_assert (sym->ts.type == BT_COMPLEX && gfc_option.flag_f2c); gcc_assert (sym->ts.type == BT_COMPLEX && gfc_option.flag_f2c);
se->expr = build_fold_indirect_ref (var); se->expr = build_fold_indirect_ref_loc (input_location,
var);
} }
} }
} }
@ -3157,7 +3181,8 @@ fill_with_spaces (tree start, tree type, tree size)
/* For a simple char type, we can call memset(). */ /* For a simple char type, we can call memset(). */
if (compare_tree_int (TYPE_SIZE_UNIT (type), 1) == 0) if (compare_tree_int (TYPE_SIZE_UNIT (type), 1) == 0)
return build_call_expr (built_in_decls[BUILT_IN_MEMSET], 3, start, return build_call_expr_loc (input_location,
built_in_decls[BUILT_IN_MEMSET], 3, start,
build_int_cst (gfc_get_int_type (gfc_c_int_kind), build_int_cst (gfc_get_int_type (gfc_c_int_kind),
lang_hooks.to_target_charset (' ')), lang_hooks.to_target_charset (' ')),
size); size);
@ -3318,11 +3343,13 @@ gfc_trans_string_copy (stmtblock_t * block, tree dlength, tree dest,
/* Truncate string if source is too long. */ /* Truncate string if source is too long. */
cond2 = fold_build2 (GE_EXPR, boolean_type_node, slen, dlen); cond2 = fold_build2 (GE_EXPR, boolean_type_node, slen, dlen);
tmp2 = build_call_expr (built_in_decls[BUILT_IN_MEMMOVE], tmp2 = build_call_expr_loc (input_location,
built_in_decls[BUILT_IN_MEMMOVE],
3, dest, src, dlen); 3, dest, src, dlen);
/* Else copy and pad with spaces. */ /* Else copy and pad with spaces. */
tmp3 = build_call_expr (built_in_decls[BUILT_IN_MEMMOVE], tmp3 = build_call_expr_loc (input_location,
built_in_decls[BUILT_IN_MEMMOVE],
3, dest, src, slen); 3, dest, src, slen);
tmp4 = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (dest), dest, tmp4 = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (dest), dest,
@ -3465,7 +3492,7 @@ gfc_get_proc_ptr_comp (gfc_se *se, gfc_expr *e)
e2 = gfc_copy_expr (e); e2 = gfc_copy_expr (e);
e2->expr_type = EXPR_VARIABLE; e2->expr_type = EXPR_VARIABLE;
gfc_conv_expr (&comp_se, e2); gfc_conv_expr (&comp_se, e2);
comp_se.expr = build_fold_addr_expr (comp_se.expr); comp_se.expr = build_fold_addr_expr_loc (input_location, comp_se.expr);
return gfc_evaluate_now (comp_se.expr, &se->pre); return gfc_evaluate_now (comp_se.expr, &se->pre);
} }
@ -4192,11 +4219,13 @@ gfc_trans_pointer_assignment (gfc_expr * expr1, gfc_expr * expr2)
if (expr1->symtree->n.sym->attr.proc_pointer if (expr1->symtree->n.sym->attr.proc_pointer
&& expr1->symtree->n.sym->attr.dummy) && expr1->symtree->n.sym->attr.dummy)
lse.expr = build_fold_indirect_ref (lse.expr); lse.expr = build_fold_indirect_ref_loc (input_location,
lse.expr);
if (expr2->symtree && expr2->symtree->n.sym->attr.proc_pointer if (expr2->symtree && expr2->symtree->n.sym->attr.proc_pointer
&& expr2->symtree->n.sym->attr.dummy) && expr2->symtree->n.sym->attr.dummy)
rse.expr = build_fold_indirect_ref (rse.expr); rse.expr = build_fold_indirect_ref_loc (input_location,
rse.expr);
gfc_add_block_to_block (&block, &lse.pre); gfc_add_block_to_block (&block, &lse.pre);
gfc_add_block_to_block (&block, &rse.pre); gfc_add_block_to_block (&block, &rse.pre);
@ -4594,7 +4623,8 @@ gfc_trans_zero_assign (gfc_expr * expr)
len = fold_convert (size_type_node, len); len = fold_convert (size_type_node, len);
/* Construct call to __builtin_memset. */ /* Construct call to __builtin_memset. */
tmp = build_call_expr (built_in_decls[BUILT_IN_MEMSET], tmp = build_call_expr_loc (input_location,
built_in_decls[BUILT_IN_MEMSET],
3, dest, integer_zero_node, len); 3, dest, integer_zero_node, len);
return fold_convert (void_type_node, tmp); return fold_convert (void_type_node, tmp);
} }
@ -4622,7 +4652,8 @@ gfc_build_memcpy_call (tree dst, tree src, tree len)
len = fold_convert (size_type_node, len); len = fold_convert (size_type_node, len);
/* Construct call to __builtin_memcpy. */ /* Construct call to __builtin_memcpy. */
tmp = build_call_expr (built_in_decls[BUILT_IN_MEMCPY], 3, dst, src, len); tmp = build_call_expr_loc (input_location,
built_in_decls[BUILT_IN_MEMCPY], 3, dst, src, len);
return fold_convert (void_type_node, tmp); return fold_convert (void_type_node, tmp);
} }

View File

@ -273,7 +273,8 @@ gfc_conv_intrinsic_conversion (gfc_se * se, gfc_expr * expr)
/* Call the library function that will perform the conversion. */ /* Call the library function that will perform the conversion. */
gcc_assert (nargs >= 2); gcc_assert (nargs >= 2);
tmp = build_call_expr (fndecl, 3, addr, args[0], args[1]); tmp = build_call_expr_loc (input_location,
fndecl, 3, addr, args[0], args[1]);
gfc_add_expr_to_block (&se->pre, tmp); gfc_add_expr_to_block (&se->pre, tmp);
/* Free the temporary afterwards. */ /* Free the temporary afterwards. */
@ -363,7 +364,8 @@ build_round_expr (tree arg, tree restype)
else else
gcc_unreachable (); gcc_unreachable ();
return fold_convert (restype, build_call_expr (fn, 1, arg)); return fold_convert (restype, build_call_expr_loc (input_location,
fn, 1, arg));
} }
@ -475,7 +477,8 @@ gfc_conv_intrinsic_aint (gfc_se * se, gfc_expr * expr, enum rounding_mode op)
if (n != END_BUILTINS) if (n != END_BUILTINS)
{ {
tmp = built_in_decls[n]; tmp = built_in_decls[n];
se->expr = build_call_expr (tmp, 1, arg[0]); se->expr = build_call_expr_loc (input_location,
tmp, 1, arg[0]);
return; return;
} }
@ -745,7 +748,7 @@ gfc_conv_intrinsic_lib_function (gfc_se * se, gfc_expr * expr)
rettype = TREE_TYPE (TREE_TYPE (fndecl)); rettype = TREE_TYPE (TREE_TYPE (fndecl));
fndecl = build_addr (fndecl, current_function_decl); fndecl = build_addr (fndecl, current_function_decl);
se->expr = build_call_array (rettype, fndecl, num_args, args); se->expr = build_call_array_loc (input_location, rettype, fndecl, num_args, args);
} }
@ -808,7 +811,8 @@ gfc_conv_intrinsic_exponent (gfc_se *se, gfc_expr *expr)
gfc_conv_intrinsic_function_args (se, expr, &arg, 1); gfc_conv_intrinsic_function_args (se, expr, &arg, 1);
res = gfc_create_var (integer_type_node, NULL); res = gfc_create_var (integer_type_node, NULL);
tmp = build_call_expr (built_in_decls[frexp], 2, arg, tmp = build_call_expr_loc (input_location,
built_in_decls[frexp], 2, arg,
gfc_build_addr_expr (NULL_TREE, res)); gfc_build_addr_expr (NULL_TREE, res));
gfc_add_expr_to_block (&se->pre, tmp); gfc_add_expr_to_block (&se->pre, tmp);
@ -1054,7 +1058,8 @@ gfc_conv_intrinsic_abs (gfc_se * se, gfc_expr * expr)
default: default:
gcc_unreachable (); gcc_unreachable ();
} }
se->expr = build_call_expr (built_in_decls[n], 1, arg); se->expr = build_call_expr_loc (input_location,
built_in_decls[n], 1, arg);
break; break;
default: default:
@ -1150,7 +1155,8 @@ gfc_conv_intrinsic_mod (gfc_se * se, gfc_expr * expr, int modulo)
if (n != END_BUILTINS) if (n != END_BUILTINS)
{ {
tmp = build_addr (built_in_decls[n], current_function_decl); tmp = build_addr (built_in_decls[n], current_function_decl);
se->expr = build_call_array (TREE_TYPE (TREE_TYPE (built_in_decls[n])), se->expr = build_call_array_loc (input_location,
TREE_TYPE (TREE_TYPE (built_in_decls[n])),
tmp, 2, args); tmp, 2, args);
if (modulo == 0) if (modulo == 0)
return; return;
@ -1297,7 +1303,8 @@ gfc_conv_intrinsic_sign (gfc_se * se, gfc_expr * expr)
build_call_expr (tmp, 2, args[0], args[1])); build_call_expr (tmp, 2, args[0], args[1]));
} }
else else
se->expr = build_call_expr (tmp, 2, args[0], args[1]); se->expr = build_call_expr_loc (input_location,
tmp, 2, args[0], args[1]);
return; return;
} }
@ -1400,7 +1407,8 @@ gfc_conv_intrinsic_ctime (gfc_se * se, gfc_expr * expr)
args[1] = gfc_build_addr_expr (NULL_TREE, len); args[1] = gfc_build_addr_expr (NULL_TREE, len);
fndecl = build_addr (gfor_fndecl_ctime, current_function_decl); fndecl = build_addr (gfor_fndecl_ctime, current_function_decl);
tmp = build_call_array (TREE_TYPE (TREE_TYPE (gfor_fndecl_ctime)), tmp = build_call_array_loc (input_location,
TREE_TYPE (TREE_TYPE (gfor_fndecl_ctime)),
fndecl, num_args, args); fndecl, num_args, args);
gfc_add_expr_to_block (&se->pre, tmp); gfc_add_expr_to_block (&se->pre, tmp);
@ -1438,7 +1446,8 @@ gfc_conv_intrinsic_fdate (gfc_se * se, gfc_expr * expr)
args[1] = gfc_build_addr_expr (NULL_TREE, len); args[1] = gfc_build_addr_expr (NULL_TREE, len);
fndecl = build_addr (gfor_fndecl_fdate, current_function_decl); fndecl = build_addr (gfor_fndecl_fdate, current_function_decl);
tmp = build_call_array (TREE_TYPE (TREE_TYPE (gfor_fndecl_fdate)), tmp = build_call_array_loc (input_location,
TREE_TYPE (TREE_TYPE (gfor_fndecl_fdate)),
fndecl, num_args, args); fndecl, num_args, args);
gfc_add_expr_to_block (&se->pre, tmp); gfc_add_expr_to_block (&se->pre, tmp);
@ -1478,7 +1487,8 @@ gfc_conv_intrinsic_ttynam (gfc_se * se, gfc_expr * expr)
args[1] = gfc_build_addr_expr (NULL_TREE, len); args[1] = gfc_build_addr_expr (NULL_TREE, len);
fndecl = build_addr (gfor_fndecl_ttynam, current_function_decl); fndecl = build_addr (gfor_fndecl_ttynam, current_function_decl);
tmp = build_call_array (TREE_TYPE (TREE_TYPE (gfor_fndecl_ttynam)), tmp = build_call_array_loc (input_location,
TREE_TYPE (TREE_TYPE (gfor_fndecl_ttynam)),
fndecl, num_args, args); fndecl, num_args, args);
gfc_add_expr_to_block (&se->pre, tmp); gfc_add_expr_to_block (&se->pre, tmp);
@ -1546,9 +1556,10 @@ gfc_conv_intrinsic_minmax (gfc_se * se, gfc_expr * expr, enum tree_code op)
if (argexpr->expr->expr_type == EXPR_VARIABLE if (argexpr->expr->expr_type == EXPR_VARIABLE
&& argexpr->expr->symtree->n.sym->attr.optional && argexpr->expr->symtree->n.sym->attr.optional
&& TREE_CODE (val) == INDIRECT_REF) && TREE_CODE (val) == INDIRECT_REF)
cond = fold_build2 cond = fold_build2_loc (input_location,
(NE_EXPR, boolean_type_node, TREE_OPERAND (val, 0), NE_EXPR, boolean_type_node,
build_int_cst (TREE_TYPE (TREE_OPERAND (val, 0)), 0)); TREE_OPERAND (val, 0),
build_int_cst (TREE_TYPE (TREE_OPERAND (val, 0)), 0));
else else
{ {
cond = NULL_TREE; cond = NULL_TREE;
@ -1567,7 +1578,8 @@ gfc_conv_intrinsic_minmax (gfc_se * se, gfc_expr * expr, enum tree_code op)
to help performance of programs that don't rely on IEEE semantics. */ to help performance of programs that don't rely on IEEE semantics. */
if (FLOAT_TYPE_P (TREE_TYPE (mvar))) if (FLOAT_TYPE_P (TREE_TYPE (mvar)))
{ {
isnan = build_call_expr (built_in_decls[BUILT_IN_ISNAN], 1, mvar); isnan = build_call_expr_loc (input_location,
built_in_decls[BUILT_IN_ISNAN], 1, mvar);
tmp = fold_build2 (TRUTH_OR_EXPR, boolean_type_node, tmp, tmp = fold_build2 (TRUTH_OR_EXPR, boolean_type_node, tmp,
fold_convert (boolean_type_node, isnan)); fold_convert (boolean_type_node, isnan));
} }
@ -1615,7 +1627,8 @@ gfc_conv_intrinsic_minmax_char (gfc_se * se, gfc_expr * expr, int op)
/* Make the function call. */ /* Make the function call. */
fndecl = build_addr (function, current_function_decl); fndecl = build_addr (function, current_function_decl);
tmp = build_call_array (TREE_TYPE (TREE_TYPE (function)), fndecl, tmp = build_call_array_loc (input_location,
TREE_TYPE (TREE_TYPE (function)), fndecl,
nargs + 4, args); nargs + 4, args);
gfc_add_expr_to_block (&se->pre, tmp); gfc_add_expr_to_block (&se->pre, tmp);
@ -2692,7 +2705,8 @@ gfc_conv_intrinsic_ishftc (gfc_se * se, gfc_expr * expr)
default: default:
gcc_unreachable (); gcc_unreachable ();
} }
se->expr = build_call_expr (tmp, 3, args[0], args[1], args[2]); se->expr = build_call_expr_loc (input_location,
tmp, 3, args[0], args[1], args[2]);
/* Convert the result back to the original type, if we extended /* Convert the result back to the original type, if we extended
the first argument's width above. */ the first argument's width above. */
if (expr->ts.kind < 4) if (expr->ts.kind < 4)
@ -2840,7 +2854,8 @@ gfc_conv_intrinsic_trailz (gfc_se * se, gfc_expr *expr)
result_type = gfc_get_int_type (gfc_default_integer_kind); result_type = gfc_get_int_type (gfc_default_integer_kind);
/* Compute TRAILZ for the case i .ne. 0. */ /* Compute TRAILZ for the case i .ne. 0. */
trailz = fold_convert (result_type, build_call_expr (func, 1, arg)); trailz = fold_convert (result_type, build_call_expr_loc (input_location,
func, 1, arg));
/* Build BIT_SIZE. */ /* Build BIT_SIZE. */
bit_size = build_int_cst (result_type, argsize); bit_size = build_int_cst (result_type, argsize);
@ -2991,7 +3006,8 @@ gfc_conv_intrinsic_len_trim (gfc_se * se, gfc_expr * expr)
else else
gcc_unreachable (); gcc_unreachable ();
se->expr = build_call_expr (fndecl, 2, args[0], args[1]); se->expr = build_call_expr_loc (input_location,
fndecl, 2, args[0], args[1]);
se->expr = convert (type, se->expr); se->expr = convert (type, se->expr);
} }
@ -3027,7 +3043,8 @@ gfc_conv_intrinsic_index_scan_verify (gfc_se * se, gfc_expr * expr,
args[4] = convert (logical4_type_node, args[4]); args[4] = convert (logical4_type_node, args[4]);
fndecl = build_addr (function, current_function_decl); fndecl = build_addr (function, current_function_decl);
se->expr = build_call_array (TREE_TYPE (TREE_TYPE (function)), fndecl, se->expr = build_call_array_loc (input_location,
TREE_TYPE (TREE_TYPE (function)), fndecl,
5, args); 5, args);
se->expr = convert (type, se->expr); se->expr = convert (type, se->expr);
@ -3045,7 +3062,8 @@ gfc_conv_intrinsic_ichar (gfc_se * se, gfc_expr * expr)
args[1] = fold_build1 (NOP_EXPR, pchartype, args[1]); args[1] = fold_build1 (NOP_EXPR, pchartype, args[1]);
type = gfc_typenode_for_spec (&expr->ts); type = gfc_typenode_for_spec (&expr->ts);
se->expr = build_fold_indirect_ref (args[1]); se->expr = build_fold_indirect_ref_loc (input_location,
args[1]);
se->expr = convert (type, se->expr); se->expr = convert (type, se->expr);
} }
@ -3058,7 +3076,8 @@ gfc_conv_intrinsic_isnan (gfc_se * se, gfc_expr * expr)
tree arg; tree arg;
gfc_conv_intrinsic_function_args (se, expr, &arg, 1); gfc_conv_intrinsic_function_args (se, expr, &arg, 1);
se->expr = build_call_expr (built_in_decls[BUILT_IN_ISNAN], 1, arg); se->expr = build_call_expr_loc (input_location,
built_in_decls[BUILT_IN_ISNAN], 1, arg);
STRIP_TYPE_NOPS (se->expr); STRIP_TYPE_NOPS (se->expr);
se->expr = fold_convert (gfc_typenode_for_spec (&expr->ts), se->expr); se->expr = fold_convert (gfc_typenode_for_spec (&expr->ts), se->expr);
} }
@ -3149,7 +3168,8 @@ gfc_conv_intrinsic_fraction (gfc_se * se, gfc_expr * expr)
type = gfc_typenode_for_spec (&expr->ts); type = gfc_typenode_for_spec (&expr->ts);
gfc_conv_intrinsic_function_args (se, expr, &arg, 1); gfc_conv_intrinsic_function_args (se, expr, &arg, 1);
tmp = gfc_create_var (integer_type_node, NULL); tmp = gfc_create_var (integer_type_node, NULL);
se->expr = build_call_expr (built_in_decls[frexp], 2, se->expr = build_call_expr_loc (input_location,
built_in_decls[frexp], 2,
fold_convert (type, arg), fold_convert (type, arg),
gfc_build_addr_expr (NULL_TREE, tmp)); gfc_build_addr_expr (NULL_TREE, tmp));
se->expr = fold_convert (type, se->expr); se->expr = fold_convert (type, se->expr);
@ -3190,10 +3210,13 @@ gfc_conv_intrinsic_nearest (gfc_se * se, gfc_expr * expr)
type = gfc_typenode_for_spec (&expr->ts); type = gfc_typenode_for_spec (&expr->ts);
gfc_conv_intrinsic_function_args (se, expr, args, 2); gfc_conv_intrinsic_function_args (se, expr, args, 2);
tmp = build_call_expr (built_in_decls[copysign], 2, tmp = build_call_expr_loc (input_location,
build_call_expr (built_in_decls[huge_val], 0), built_in_decls[copysign], 2,
build_call_expr_loc (input_location,
built_in_decls[huge_val], 0),
fold_convert (type, args[1])); fold_convert (type, args[1]));
se->expr = build_call_expr (built_in_decls[nextafter], 2, se->expr = build_call_expr_loc (input_location,
built_in_decls[nextafter], 2,
fold_convert (type, args[0]), tmp); fold_convert (type, args[0]), tmp);
se->expr = fold_convert (type, se->expr); se->expr = fold_convert (type, se->expr);
} }
@ -3258,15 +3281,17 @@ gfc_conv_intrinsic_spacing (gfc_se * se, gfc_expr * expr)
/* Build the block for s /= 0. */ /* Build the block for s /= 0. */
gfc_start_block (&block); gfc_start_block (&block);
tmp = build_call_expr (built_in_decls[frexp], 2, arg, tmp = build_call_expr_loc (input_location,
built_in_decls[frexp], 2, arg,
gfc_build_addr_expr (NULL_TREE, e)); gfc_build_addr_expr (NULL_TREE, e));
gfc_add_expr_to_block (&block, tmp); gfc_add_expr_to_block (&block, tmp);
tmp = fold_build2 (MINUS_EXPR, integer_type_node, e, prec); tmp = fold_build2 (MINUS_EXPR, integer_type_node, e, prec);
gfc_add_modify (&block, e, fold_build2 (MAX_EXPR, integer_type_node, gfc_add_modify (&block, e, fold_build2 (MAX_EXPR, integer_type_node,
tmp, emin)); tmp, emin));
tmp = build_call_expr (built_in_decls[scalbn], 2, tmp = build_call_expr_loc (input_location,
built_in_decls[scalbn], 2,
build_real_from_int_cst (type, integer_one_node), e); build_real_from_int_cst (type, integer_one_node), e);
gfc_add_modify (&block, res, tmp); gfc_add_modify (&block, res, tmp);
@ -3332,17 +3357,20 @@ gfc_conv_intrinsic_rrspacing (gfc_se * se, gfc_expr * expr)
e = gfc_create_var (integer_type_node, NULL); e = gfc_create_var (integer_type_node, NULL);
x = gfc_create_var (type, NULL); x = gfc_create_var (type, NULL);
gfc_add_modify (&se->pre, x, gfc_add_modify (&se->pre, x,
build_call_expr (built_in_decls[fabs], 1, arg)); build_call_expr_loc (input_location,
built_in_decls[fabs], 1, arg));
gfc_start_block (&block); gfc_start_block (&block);
tmp = build_call_expr (built_in_decls[frexp], 2, arg, tmp = build_call_expr_loc (input_location,
built_in_decls[frexp], 2, arg,
gfc_build_addr_expr (NULL_TREE, e)); gfc_build_addr_expr (NULL_TREE, e));
gfc_add_expr_to_block (&block, tmp); gfc_add_expr_to_block (&block, tmp);
tmp = fold_build2 (MINUS_EXPR, integer_type_node, tmp = fold_build2 (MINUS_EXPR, integer_type_node,
build_int_cst (NULL_TREE, prec), e); build_int_cst (NULL_TREE, prec), e);
tmp = build_call_expr (built_in_decls[scalbn], 2, x, tmp); tmp = build_call_expr_loc (input_location,
built_in_decls[scalbn], 2, x, tmp);
gfc_add_modify (&block, x, tmp); gfc_add_modify (&block, x, tmp);
stmt = gfc_finish_block (&block); stmt = gfc_finish_block (&block);
@ -3380,7 +3408,8 @@ gfc_conv_intrinsic_scale (gfc_se * se, gfc_expr * expr)
type = gfc_typenode_for_spec (&expr->ts); type = gfc_typenode_for_spec (&expr->ts);
gfc_conv_intrinsic_function_args (se, expr, args, 2); gfc_conv_intrinsic_function_args (se, expr, args, 2);
se->expr = build_call_expr (built_in_decls[scalbn], 2, se->expr = build_call_expr_loc (input_location,
built_in_decls[scalbn], 2,
fold_convert (type, args[0]), fold_convert (type, args[0]),
fold_convert (integer_type_node, args[1])); fold_convert (integer_type_node, args[1]));
se->expr = fold_convert (type, se->expr); se->expr = fold_convert (type, se->expr);
@ -3418,10 +3447,12 @@ gfc_conv_intrinsic_set_exponent (gfc_se * se, gfc_expr * expr)
gfc_conv_intrinsic_function_args (se, expr, args, 2); gfc_conv_intrinsic_function_args (se, expr, args, 2);
tmp = gfc_create_var (integer_type_node, NULL); tmp = gfc_create_var (integer_type_node, NULL);
tmp = build_call_expr (built_in_decls[frexp], 2, tmp = build_call_expr_loc (input_location,
built_in_decls[frexp], 2,
fold_convert (type, args[0]), fold_convert (type, args[0]),
gfc_build_addr_expr (NULL_TREE, tmp)); gfc_build_addr_expr (NULL_TREE, tmp));
se->expr = build_call_expr (built_in_decls[scalbn], 2, tmp, se->expr = build_call_expr_loc (input_location,
built_in_decls[scalbn], 2, tmp,
fold_convert (integer_type_node, args[1])); fold_convert (integer_type_node, args[1]));
se->expr = fold_convert (type, se->expr); se->expr = fold_convert (type, se->expr);
} }
@ -3451,7 +3482,8 @@ gfc_conv_intrinsic_size (gfc_se * se, gfc_expr * expr)
arg1 = gfc_evaluate_now (argse.expr, &se->pre); arg1 = gfc_evaluate_now (argse.expr, &se->pre);
/* Build the call to size0. */ /* Build the call to size0. */
fncall0 = build_call_expr (gfor_fndecl_size0, 1, arg1); fncall0 = build_call_expr_loc (input_location,
gfor_fndecl_size0, 1, arg1);
actual = actual->next; actual = actual->next;
@ -3470,7 +3502,8 @@ gfc_conv_intrinsic_size (gfc_se * se, gfc_expr * expr)
{ {
tree tmp; tree tmp;
/* Build the call to size1. */ /* Build the call to size1. */
fncall1 = build_call_expr (gfor_fndecl_size1, 2, fncall1 = build_call_expr_loc (input_location,
gfor_fndecl_size1, 2,
arg1, argse.expr); arg1, argse.expr);
gfc_init_se (&argse, NULL); gfc_init_se (&argse, NULL);
@ -3503,7 +3536,8 @@ gfc_conv_intrinsic_size (gfc_se * se, gfc_expr * expr)
{ {
tree ubound, lbound; tree ubound, lbound;
arg1 = build_fold_indirect_ref (arg1); arg1 = build_fold_indirect_ref_loc (input_location,
arg1);
ubound = gfc_conv_descriptor_ubound_get (arg1, argse.expr); ubound = gfc_conv_descriptor_ubound_get (arg1, argse.expr);
lbound = gfc_conv_descriptor_lbound_get (arg1, argse.expr); lbound = gfc_conv_descriptor_lbound_get (arg1, argse.expr);
se->expr = fold_build2 (MINUS_EXPR, gfc_array_index_type, se->expr = fold_build2 (MINUS_EXPR, gfc_array_index_type,
@ -3561,7 +3595,8 @@ gfc_conv_intrinsic_sizeof (gfc_se *se, gfc_expr *expr)
gfc_conv_expr_reference (&argse, arg); gfc_conv_expr_reference (&argse, arg);
source = argse.expr; source = argse.expr;
type = TREE_TYPE (build_fold_indirect_ref (argse.expr)); type = TREE_TYPE (build_fold_indirect_ref_loc (input_location,
argse.expr));
/* Obtain the source word length. */ /* Obtain the source word length. */
if (arg->ts.type == BT_CHARACTER) if (arg->ts.type == BT_CHARACTER)
@ -3641,7 +3676,8 @@ gfc_conv_intrinsic_adjust (gfc_se * se, gfc_expr * expr, tree fndecl)
var = gfc_conv_string_tmp (se, type, len); var = gfc_conv_string_tmp (se, type, len);
args[0] = var; args[0] = var;
tmp = build_call_expr (fndecl, 3, args[0], args[1], args[2]); tmp = build_call_expr_loc (input_location,
fndecl, 3, args[0], args[1], args[2]);
gfc_add_expr_to_block (&se->pre, tmp); gfc_add_expr_to_block (&se->pre, tmp);
se->expr = var; se->expr = var;
se->string_length = len; se->string_length = len;
@ -3719,7 +3755,8 @@ gfc_conv_intrinsic_transfer (gfc_se * se, gfc_expr * expr)
gfc_conv_expr_reference (&argse, arg->expr); gfc_conv_expr_reference (&argse, arg->expr);
source = argse.expr; source = argse.expr;
source_type = TREE_TYPE (build_fold_indirect_ref (argse.expr)); source_type = TREE_TYPE (build_fold_indirect_ref_loc (input_location,
argse.expr));
/* Obtain the source word length. */ /* Obtain the source word length. */
if (arg->expr->ts.type == BT_CHARACTER) if (arg->expr->ts.type == BT_CHARACTER)
@ -3745,7 +3782,8 @@ gfc_conv_intrinsic_transfer (gfc_se * se, gfc_expr * expr)
if (gfc_option.warn_array_temp) if (gfc_option.warn_array_temp)
gfc_warning ("Creating array temporary at %L", &expr->where); gfc_warning ("Creating array temporary at %L", &expr->where);
source = build_call_expr (gfor_fndecl_in_pack, 1, tmp); source = build_call_expr_loc (input_location,
gfor_fndecl_in_pack, 1, tmp);
source = gfc_evaluate_now (source, &argse.pre); source = gfc_evaluate_now (source, &argse.pre);
/* Free the temporary. */ /* Free the temporary. */
@ -3811,7 +3849,8 @@ gfc_conv_intrinsic_transfer (gfc_se * se, gfc_expr * expr)
if (ss == gfc_ss_terminator) if (ss == gfc_ss_terminator)
{ {
gfc_conv_expr_reference (&argse, arg->expr); gfc_conv_expr_reference (&argse, arg->expr);
mold_type = TREE_TYPE (build_fold_indirect_ref (argse.expr)); mold_type = TREE_TYPE (build_fold_indirect_ref_loc (input_location,
argse.expr));
} }
else else
{ {
@ -3853,7 +3892,8 @@ gfc_conv_intrinsic_transfer (gfc_se * se, gfc_expr * expr)
gfc_init_se (&argse, NULL); gfc_init_se (&argse, NULL);
gfc_conv_expr_reference (&argse, arg->expr); gfc_conv_expr_reference (&argse, arg->expr);
tmp = convert (gfc_array_index_type, tmp = convert (gfc_array_index_type,
build_fold_indirect_ref (argse.expr)); build_fold_indirect_ref_loc (input_location,
argse.expr));
gfc_add_block_to_block (&se->pre, &argse.pre); gfc_add_block_to_block (&se->pre, &argse.pre);
gfc_add_block_to_block (&se->post, &argse.post); gfc_add_block_to_block (&se->post, &argse.post);
} }
@ -3918,7 +3958,8 @@ gfc_conv_intrinsic_transfer (gfc_se * se, gfc_expr * expr)
tmp = fold_convert (pvoid_type_node, tmp); tmp = fold_convert (pvoid_type_node, tmp);
/* Use memcpy to do the transfer. */ /* Use memcpy to do the transfer. */
tmp = build_call_expr (built_in_decls[BUILT_IN_MEMCPY], tmp = build_call_expr_loc (input_location,
built_in_decls[BUILT_IN_MEMCPY],
3, 3,
tmp, tmp,
fold_convert (pvoid_type_node, source), fold_convert (pvoid_type_node, source),
@ -3959,7 +4000,8 @@ scalar_transfer:
tmp = gfc_call_malloc (&block, tmp, dest_word_len); tmp = gfc_call_malloc (&block, tmp, dest_word_len);
gfc_add_modify (&block, tmpdecl, gfc_add_modify (&block, tmpdecl,
fold_convert (TREE_TYPE (ptr), tmp)); fold_convert (TREE_TYPE (ptr), tmp));
tmp = build_call_expr (built_in_decls[BUILT_IN_MEMCPY], 3, tmp = build_call_expr_loc (input_location,
built_in_decls[BUILT_IN_MEMCPY], 3,
fold_convert (pvoid_type_node, tmpdecl), fold_convert (pvoid_type_node, tmpdecl),
fold_convert (pvoid_type_node, ptr), fold_convert (pvoid_type_node, ptr),
extent); extent);
@ -3983,7 +4025,8 @@ scalar_transfer:
/* Use memcpy to do the transfer. */ /* Use memcpy to do the transfer. */
tmp = gfc_build_addr_expr (NULL_TREE, tmpdecl); tmp = gfc_build_addr_expr (NULL_TREE, tmpdecl);
tmp = build_call_expr (built_in_decls[BUILT_IN_MEMCPY], 3, tmp = build_call_expr_loc (input_location,
built_in_decls[BUILT_IN_MEMCPY], 3,
fold_convert (pvoid_type_node, tmp), fold_convert (pvoid_type_node, tmp),
fold_convert (pvoid_type_node, ptr), fold_convert (pvoid_type_node, ptr),
extent); extent);
@ -4113,7 +4156,8 @@ gfc_conv_associated (gfc_se *se, gfc_expr *expr)
gfc_conv_expr_descriptor (&arg2se, arg2->expr, ss2); gfc_conv_expr_descriptor (&arg2se, arg2->expr, ss2);
gfc_add_block_to_block (&se->pre, &arg2se.pre); gfc_add_block_to_block (&se->pre, &arg2se.pre);
gfc_add_block_to_block (&se->post, &arg2se.post); gfc_add_block_to_block (&se->post, &arg2se.post);
se->expr = build_call_expr (gfor_fndecl_associated, 2, se->expr = build_call_expr_loc (input_location,
gfor_fndecl_associated, 2,
arg1se.expr, arg2se.expr); arg1se.expr, arg2se.expr);
se->expr = convert (boolean_type_node, se->expr); se->expr = convert (boolean_type_node, se->expr);
se->expr = fold_build2 (TRUTH_AND_EXPR, boolean_type_node, se->expr = fold_build2 (TRUTH_AND_EXPR, boolean_type_node,
@ -4139,7 +4183,8 @@ gfc_conv_intrinsic_sc_kind (gfc_se *se, gfc_expr *expr)
tree args[2]; tree args[2];
gfc_conv_intrinsic_function_args (se, expr, args, 2); gfc_conv_intrinsic_function_args (se, expr, args, 2);
se->expr = build_call_expr (gfor_fndecl_sc_kind, 2, args[0], args[1]); se->expr = build_call_expr_loc (input_location,
gfor_fndecl_sc_kind, 2, args[0], args[1]);
se->expr = fold_convert (gfc_typenode_for_spec (&expr->ts), se->expr); se->expr = fold_convert (gfc_typenode_for_spec (&expr->ts), se->expr);
} }
@ -4159,7 +4204,8 @@ gfc_conv_intrinsic_si_kind (gfc_se *se, gfc_expr *expr)
/* Convert it to the required type. */ /* Convert it to the required type. */
type = gfc_typenode_for_spec (&expr->ts); type = gfc_typenode_for_spec (&expr->ts);
se->expr = build_call_expr (gfor_fndecl_si_kind, 1, arg); se->expr = build_call_expr_loc (input_location,
gfor_fndecl_si_kind, 1, arg);
se->expr = fold_convert (type, se->expr); se->expr = fold_convert (type, se->expr);
} }
@ -4203,7 +4249,8 @@ gfc_conv_intrinsic_sr_kind (gfc_se *se, gfc_expr *expr)
/* Convert it to the required type. */ /* Convert it to the required type. */
type = gfc_typenode_for_spec (&expr->ts); type = gfc_typenode_for_spec (&expr->ts);
se->expr = build_function_call_expr (gfor_fndecl_sr_kind, args); se->expr = build_function_call_expr (input_location,
gfor_fndecl_sr_kind, args);
se->expr = fold_convert (type, se->expr); se->expr = fold_convert (type, se->expr);
} }
@ -4242,7 +4289,8 @@ gfc_conv_intrinsic_trim (gfc_se * se, gfc_expr * expr)
gcc_unreachable (); gcc_unreachable ();
fndecl = build_addr (function, current_function_decl); fndecl = build_addr (function, current_function_decl);
tmp = build_call_array (TREE_TYPE (TREE_TYPE (function)), fndecl, tmp = build_call_array_loc (input_location,
TREE_TYPE (TREE_TYPE (function)), fndecl,
num_args, args); num_args, args);
gfc_add_expr_to_block (&se->pre, tmp); gfc_add_expr_to_block (&se->pre, tmp);
@ -4353,7 +4401,8 @@ gfc_conv_intrinsic_repeat (gfc_se * se, gfc_expr * expr)
tmp = fold_build2 (POINTER_PLUS_EXPR, pvoid_type_node, tmp = fold_build2 (POINTER_PLUS_EXPR, pvoid_type_node,
fold_convert (pvoid_type_node, dest), fold_convert (pvoid_type_node, dest),
fold_convert (sizetype, tmp)); fold_convert (sizetype, tmp));
tmp = build_call_expr (built_in_decls[BUILT_IN_MEMMOVE], 3, tmp, src, tmp = build_call_expr_loc (input_location,
built_in_decls[BUILT_IN_MEMMOVE], 3, tmp, src,
fold_build2 (MULT_EXPR, size_type_node, slen, fold_build2 (MULT_EXPR, size_type_node, slen,
fold_convert (size_type_node, size))); fold_convert (size_type_node, size)));
gfc_add_expr_to_block (&body, tmp); gfc_add_expr_to_block (&body, tmp);
@ -4392,7 +4441,8 @@ gfc_conv_intrinsic_iargc (gfc_se * se, gfc_expr * expr)
/* Call the library function. This always returns an INTEGER(4). */ /* Call the library function. This always returns an INTEGER(4). */
fndecl = gfor_fndecl_iargc; fndecl = gfor_fndecl_iargc;
tmp = build_call_expr (fndecl, 0); tmp = build_call_expr_loc (input_location,
fndecl, 0);
/* Convert it to the required type. */ /* Convert it to the required type. */
type = gfc_typenode_for_spec (&expr->ts); type = gfc_typenode_for_spec (&expr->ts);

View File

@ -246,7 +246,8 @@ gfc_trans_io_runtime_check (tree cond, tree var, int error_code,
gfc_build_localized_cstring_const (message)); gfc_build_localized_cstring_const (message));
gfc_free(message); gfc_free(message);
tmp = build_call_expr (gfor_fndecl_generate_error, 3, arg1, arg2, arg3); tmp = build_call_expr_loc (input_location,
gfor_fndecl_generate_error, 3, arg1, arg2, arg3);
gfc_add_expr_to_block (&block, tmp); gfc_add_expr_to_block (&block, tmp);
@ -261,7 +262,8 @@ gfc_trans_io_runtime_check (tree cond, tree var, int error_code,
/* Tell the compiler that this isn't likely. */ /* Tell the compiler that this isn't likely. */
cond = fold_convert (long_integer_type_node, cond); cond = fold_convert (long_integer_type_node, cond);
tmp = build_int_cst (long_integer_type_node, 0); tmp = build_int_cst (long_integer_type_node, 0);
cond = build_call_expr (built_in_decls[BUILT_IN_EXPECT], 2, cond, tmp); cond = build_call_expr_loc (input_location,
built_in_decls[BUILT_IN_EXPECT], 2, cond, tmp);
cond = fold_convert (boolean_type_node, cond); cond = fold_convert (boolean_type_node, cond);
tmp = build3_v (COND_EXPR, cond, body, build_empty_stmt (input_location)); tmp = build3_v (COND_EXPR, cond, body, build_empty_stmt (input_location));
@ -740,7 +742,8 @@ set_internal_unit (stmtblock_t * block, stmtblock_t * post_block,
or substring array references. */ or substring array references. */
gfc_conv_subref_array_arg (&se, e, 0, gfc_conv_subref_array_arg (&se, e, 0,
last_dt == READ ? INTENT_IN : INTENT_OUT); last_dt == READ ? INTENT_IN : INTENT_OUT);
tmp = build_fold_indirect_ref (se.expr); tmp = build_fold_indirect_ref_loc (input_location,
se.expr);
se.expr = gfc_build_addr_expr (pchar_type_node, tmp); se.expr = gfc_build_addr_expr (pchar_type_node, tmp);
tmp = gfc_conv_descriptor_data_get (tmp); tmp = gfc_conv_descriptor_data_get (tmp);
} }
@ -964,7 +967,8 @@ gfc_trans_open (gfc_code * code)
set_parameter_const (&block, var, IOPARM_common_unit, 0); set_parameter_const (&block, var, IOPARM_common_unit, 0);
tmp = gfc_build_addr_expr (NULL_TREE, var); tmp = gfc_build_addr_expr (NULL_TREE, var);
tmp = build_call_expr (iocall[IOCALL_OPEN], 1, tmp); tmp = build_call_expr_loc (input_location,
iocall[IOCALL_OPEN], 1, tmp);
gfc_add_expr_to_block (&block, tmp); gfc_add_expr_to_block (&block, tmp);
gfc_add_block_to_block (&block, &post_block); gfc_add_block_to_block (&block, &post_block);
@ -1016,7 +1020,8 @@ gfc_trans_close (gfc_code * code)
set_parameter_const (&block, var, IOPARM_common_unit, 0); set_parameter_const (&block, var, IOPARM_common_unit, 0);
tmp = gfc_build_addr_expr (NULL_TREE, var); tmp = gfc_build_addr_expr (NULL_TREE, var);
tmp = build_call_expr (iocall[IOCALL_CLOSE], 1, tmp); tmp = build_call_expr_loc (input_location,
iocall[IOCALL_CLOSE], 1, tmp);
gfc_add_expr_to_block (&block, tmp); gfc_add_expr_to_block (&block, tmp);
gfc_add_block_to_block (&block, &post_block); gfc_add_block_to_block (&block, &post_block);
@ -1066,7 +1071,8 @@ build_filepos (tree function, gfc_code * code)
set_parameter_const (&block, var, IOPARM_common_unit, 0); set_parameter_const (&block, var, IOPARM_common_unit, 0);
tmp = gfc_build_addr_expr (NULL_TREE, var); tmp = gfc_build_addr_expr (NULL_TREE, var);
tmp = build_call_expr (function, 1, tmp); tmp = build_call_expr_loc (input_location,
function, 1, tmp);
gfc_add_expr_to_block (&block, tmp); gfc_add_expr_to_block (&block, tmp);
gfc_add_block_to_block (&block, &post_block); gfc_add_block_to_block (&block, &post_block);
@ -1323,7 +1329,8 @@ gfc_trans_inquire (gfc_code * code)
set_parameter_const (&block, var, IOPARM_common_unit, 0); set_parameter_const (&block, var, IOPARM_common_unit, 0);
tmp = gfc_build_addr_expr (NULL_TREE, var); tmp = gfc_build_addr_expr (NULL_TREE, var);
tmp = build_call_expr (iocall[IOCALL_INQUIRE], 1, tmp); tmp = build_call_expr_loc (input_location,
iocall[IOCALL_INQUIRE], 1, tmp);
gfc_add_expr_to_block (&block, tmp); gfc_add_expr_to_block (&block, tmp);
gfc_add_block_to_block (&block, &post_block); gfc_add_block_to_block (&block, &post_block);
@ -1372,7 +1379,8 @@ gfc_trans_wait (gfc_code * code)
set_parameter_value (&block, var, IOPARM_common_unit, p->unit); set_parameter_value (&block, var, IOPARM_common_unit, p->unit);
tmp = gfc_build_addr_expr (NULL_TREE, var); tmp = gfc_build_addr_expr (NULL_TREE, var);
tmp = build_call_expr (iocall[IOCALL_WAIT], 1, tmp); tmp = build_call_expr_loc (input_location,
iocall[IOCALL_WAIT], 1, tmp);
gfc_add_expr_to_block (&block, tmp); gfc_add_expr_to_block (&block, tmp);
gfc_add_block_to_block (&block, &post_block); gfc_add_block_to_block (&block, &post_block);
@ -1458,7 +1466,8 @@ nml_get_addr_expr (gfc_symbol * sym, gfc_component * c,
dummy_arg_flagged = POINTER_TYPE_P (TREE_TYPE(tmp)); dummy_arg_flagged = POINTER_TYPE_P (TREE_TYPE(tmp));
itmp = (dummy_arg_flagged) ? build_fold_indirect_ref (tmp) : tmp; itmp = (dummy_arg_flagged) ? build_fold_indirect_ref_loc (input_location,
tmp) : tmp;
/* If an array, set flag and use indirect ref. if built. */ /* If an array, set flag and use indirect ref. if built. */
@ -1490,7 +1499,8 @@ nml_get_addr_expr (gfc_symbol * sym, gfc_component * c,
/* If scalar dummy, resolve indirect reference now. */ /* If scalar dummy, resolve indirect reference now. */
if (dummy_arg_flagged && !array_flagged) if (dummy_arg_flagged && !array_flagged)
tmp = build_fold_indirect_ref (tmp); tmp = build_fold_indirect_ref_loc (input_location,
tmp);
gcc_assert (tmp && POINTER_TYPE_P (TREE_TYPE (tmp))); gcc_assert (tmp && POINTER_TYPE_P (TREE_TYPE (tmp)));
@ -1584,7 +1594,8 @@ transfer_namelist_element (stmtblock_t * block, const char * var_name,
tmp = ts->cl->backend_decl; tmp = ts->cl->backend_decl;
else else
tmp = build_int_cst (gfc_charlen_type_node, 0); tmp = build_int_cst (gfc_charlen_type_node, 0);
tmp = build_call_expr (iocall[IOCALL_SET_NML_VAL], 6, tmp = build_call_expr_loc (input_location,
iocall[IOCALL_SET_NML_VAL], 6,
dt_parm_addr, addr_expr, string, dt_parm_addr, addr_expr, string,
IARG (ts->kind), tmp, dtype); IARG (ts->kind), tmp, dtype);
gfc_add_expr_to_block (block, tmp); gfc_add_expr_to_block (block, tmp);
@ -1594,7 +1605,8 @@ transfer_namelist_element (stmtblock_t * block, const char * var_name,
for ( n_dim = 0 ; n_dim < rank ; n_dim++ ) for ( n_dim = 0 ; n_dim < rank ; n_dim++ )
{ {
tmp = build_call_expr (iocall[IOCALL_SET_NML_VAL_DIM], 5, tmp = build_call_expr_loc (input_location,
iocall[IOCALL_SET_NML_VAL_DIM], 5,
dt_parm_addr, dt_parm_addr,
IARG (n_dim), IARG (n_dim),
GFC_TYPE_ARRAY_STRIDE (dt, n_dim), GFC_TYPE_ARRAY_STRIDE (dt, n_dim),
@ -1609,7 +1621,8 @@ transfer_namelist_element (stmtblock_t * block, const char * var_name,
/* Provide the RECORD_TYPE to build component references. */ /* Provide the RECORD_TYPE to build component references. */
tree expr = build_fold_indirect_ref (addr_expr); tree expr = build_fold_indirect_ref_loc (input_location,
addr_expr);
for (cmp = ts->derived->components; cmp; cmp = cmp->next) for (cmp = ts->derived->components; cmp; cmp = cmp->next)
{ {
@ -1789,7 +1802,8 @@ build_dt (tree function, gfc_code * code)
set_parameter_const (&block, var, IOPARM_common_flags, mask); set_parameter_const (&block, var, IOPARM_common_flags, mask);
tmp = gfc_build_addr_expr (NULL_TREE, var); tmp = gfc_build_addr_expr (NULL_TREE, var);
tmp = build_call_expr (function, 1, tmp); tmp = build_call_expr_loc (input_location,
function, 1, tmp);
gfc_add_expr_to_block (&block, tmp); gfc_add_expr_to_block (&block, tmp);
gfc_add_block_to_block (&block, &post_block); gfc_add_block_to_block (&block, &post_block);
@ -1869,7 +1883,8 @@ gfc_trans_dt_end (gfc_code * code)
} }
tmp = gfc_build_addr_expr (NULL_TREE, dt_parm); tmp = gfc_build_addr_expr (NULL_TREE, dt_parm);
tmp = build_call_expr (function, 1, tmp); tmp = build_call_expr_loc (input_location,
function, 1, tmp);
gfc_add_expr_to_block (&block, tmp); gfc_add_expr_to_block (&block, tmp);
gfc_add_block_to_block (&block, dt_post_end_block); gfc_add_block_to_block (&block, dt_post_end_block);
gfc_init_block (dt_post_end_block); gfc_init_block (dt_post_end_block);
@ -2043,7 +2058,8 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr, gfc_code * code)
arg2 = se->string_length; arg2 = se->string_length;
else else
{ {
tmp = build_fold_indirect_ref (addr_expr); tmp = build_fold_indirect_ref_loc (input_location,
addr_expr);
gcc_assert (TREE_CODE (TREE_TYPE (tmp)) == ARRAY_TYPE); gcc_assert (TREE_CODE (TREE_TYPE (tmp)) == ARRAY_TYPE);
arg2 = TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (tmp))); arg2 = TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (tmp)));
arg2 = fold_convert (gfc_charlen_type_node, arg2); arg2 = fold_convert (gfc_charlen_type_node, arg2);
@ -2051,7 +2067,8 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr, gfc_code * code)
arg3 = build_int_cst (NULL_TREE, kind); arg3 = build_int_cst (NULL_TREE, kind);
function = iocall[IOCALL_X_CHARACTER_WIDE]; function = iocall[IOCALL_X_CHARACTER_WIDE];
tmp = gfc_build_addr_expr (NULL_TREE, dt_parm); tmp = gfc_build_addr_expr (NULL_TREE, dt_parm);
tmp = build_call_expr (function, 4, tmp, addr_expr, arg2, arg3); tmp = build_call_expr_loc (input_location,
function, 4, tmp, addr_expr, arg2, arg3);
gfc_add_expr_to_block (&se->pre, tmp); gfc_add_expr_to_block (&se->pre, tmp);
gfc_add_block_to_block (&se->pre, &se->post); gfc_add_block_to_block (&se->pre, &se->post);
return; return;
@ -2062,7 +2079,8 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr, gfc_code * code)
arg2 = se->string_length; arg2 = se->string_length;
else else
{ {
tmp = build_fold_indirect_ref (addr_expr); tmp = build_fold_indirect_ref_loc (input_location,
addr_expr);
gcc_assert (TREE_CODE (TREE_TYPE (tmp)) == ARRAY_TYPE); gcc_assert (TREE_CODE (TREE_TYPE (tmp)) == ARRAY_TYPE);
arg2 = TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (tmp))); arg2 = TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (tmp)));
} }
@ -2072,14 +2090,16 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr, gfc_code * code)
case BT_DERIVED: case BT_DERIVED:
/* Recurse into the elements of the derived type. */ /* Recurse into the elements of the derived type. */
expr = gfc_evaluate_now (addr_expr, &se->pre); expr = gfc_evaluate_now (addr_expr, &se->pre);
expr = build_fold_indirect_ref (expr); expr = build_fold_indirect_ref_loc (input_location,
expr);
for (c = ts->derived->components; c; c = c->next) for (c = ts->derived->components; c; c = c->next)
{ {
field = c->backend_decl; field = c->backend_decl;
gcc_assert (field && TREE_CODE (field) == FIELD_DECL); gcc_assert (field && TREE_CODE (field) == FIELD_DECL);
tmp = fold_build3 (COMPONENT_REF, TREE_TYPE (field), tmp = fold_build3_loc (UNKNOWN_LOCATION,
COMPONENT_REF, TREE_TYPE (field),
expr, field, NULL_TREE); expr, field, NULL_TREE);
if (c->attr.dimension) if (c->attr.dimension)
@ -2101,7 +2121,8 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr, gfc_code * code)
} }
tmp = gfc_build_addr_expr (NULL_TREE, dt_parm); tmp = gfc_build_addr_expr (NULL_TREE, dt_parm);
tmp = build_call_expr (function, 3, tmp, addr_expr, arg2); tmp = build_call_expr_loc (input_location,
function, 3, tmp, addr_expr, arg2);
gfc_add_expr_to_block (&se->pre, tmp); gfc_add_expr_to_block (&se->pre, tmp);
gfc_add_block_to_block (&se->pre, &se->post); gfc_add_block_to_block (&se->pre, &se->post);
@ -2124,7 +2145,8 @@ transfer_array_desc (gfc_se * se, gfc_typespec * ts, tree addr_expr)
kind_arg = build_int_cst (NULL_TREE, ts->kind); kind_arg = build_int_cst (NULL_TREE, ts->kind);
tmp = gfc_build_addr_expr (NULL_TREE, dt_parm); tmp = gfc_build_addr_expr (NULL_TREE, dt_parm);
tmp = build_call_expr (iocall[IOCALL_X_ARRAY], 4, tmp = build_call_expr_loc (input_location,
iocall[IOCALL_X_ARRAY], 4,
tmp, addr_expr, kind_arg, charlen_arg); tmp, addr_expr, kind_arg, charlen_arg);
gfc_add_expr_to_block (&se->pre, tmp); gfc_add_expr_to_block (&se->pre, tmp);
gfc_add_block_to_block (&se->pre, &se->post); gfc_add_block_to_block (&se->pre, &se->post);

View File

@ -218,7 +218,8 @@ gfc_omp_clause_copy_ctor (tree clause, tree dest, tree src)
build_int_cst (pvoid_type_node, 0), build_int_cst (pvoid_type_node, 0),
size, NULL, NULL); size, NULL, NULL);
gfc_conv_descriptor_data_set (&block, dest, ptr); gfc_conv_descriptor_data_set (&block, dest, ptr);
call = build_call_expr (built_in_decls[BUILT_IN_MEMCPY], 3, ptr, call = build_call_expr_loc (input_location,
built_in_decls[BUILT_IN_MEMCPY], 3, ptr,
fold_convert (pvoid_type_node, fold_convert (pvoid_type_node,
gfc_conv_descriptor_data_get (src)), gfc_conv_descriptor_data_get (src)),
size); size);
@ -255,7 +256,8 @@ gfc_omp_clause_assign_op (tree clause ATTRIBUTE_UNUSED, tree dest, tree src)
TYPE_SIZE_UNIT (gfc_get_element_type (type))); TYPE_SIZE_UNIT (gfc_get_element_type (type)));
size = fold_build2 (MULT_EXPR, gfc_array_index_type, size, esize); size = fold_build2 (MULT_EXPR, gfc_array_index_type, size, esize);
size = gfc_evaluate_now (fold_convert (size_type_node, size), &block); size = gfc_evaluate_now (fold_convert (size_type_node, size), &block);
call = build_call_expr (built_in_decls[BUILT_IN_MEMCPY], 3, call = build_call_expr_loc (input_location,
built_in_decls[BUILT_IN_MEMCPY], 3,
fold_convert (pvoid_type_node, fold_convert (pvoid_type_node,
gfc_conv_descriptor_data_get (dest)), gfc_conv_descriptor_data_get (dest)),
fold_convert (pvoid_type_node, fold_convert (pvoid_type_node,
@ -1084,7 +1086,8 @@ gfc_trans_omp_atomic (gfc_code *code)
lhsaddr = save_expr (lhsaddr); lhsaddr = save_expr (lhsaddr);
rhs = gfc_evaluate_now (rse.expr, &block); rhs = gfc_evaluate_now (rse.expr, &block);
x = convert (TREE_TYPE (rhs), build_fold_indirect_ref (lhsaddr)); x = convert (TREE_TYPE (rhs), build_fold_indirect_ref_loc (input_location,
lhsaddr));
if (var_on_left) if (var_on_left)
x = fold_build2 (op, TREE_TYPE (rhs), x, rhs); x = fold_build2 (op, TREE_TYPE (rhs), x, rhs);
@ -1108,7 +1111,7 @@ static tree
gfc_trans_omp_barrier (void) gfc_trans_omp_barrier (void)
{ {
tree decl = built_in_decls [BUILT_IN_GOMP_BARRIER]; tree decl = built_in_decls [BUILT_IN_GOMP_BARRIER];
return build_call_expr (decl, 0); return build_call_expr_loc (input_location, decl, 0);
} }
static tree static tree
@ -1357,7 +1360,7 @@ static tree
gfc_trans_omp_flush (void) gfc_trans_omp_flush (void)
{ {
tree decl = built_in_decls [BUILT_IN_SYNCHRONIZE]; tree decl = built_in_decls [BUILT_IN_SYNCHRONIZE];
return build_call_expr (decl, 0); return build_call_expr_loc (input_location, decl, 0);
} }
static tree static tree
@ -1541,7 +1544,7 @@ static tree
gfc_trans_omp_taskwait (void) gfc_trans_omp_taskwait (void)
{ {
tree decl = built_in_decls [BUILT_IN_GOMP_TASKWAIT]; tree decl = built_in_decls [BUILT_IN_GOMP_TASKWAIT];
return build_call_expr (decl, 0); return build_call_expr_loc (input_location, decl, 0);
} }
static tree static tree

View File

@ -314,13 +314,14 @@ gfc_conv_elemental_dependencies (gfc_se * se, gfc_se * loopse,
tmp = fold_build2 (MULT_EXPR, gfc_array_index_type, tmp = fold_build2 (MULT_EXPR, gfc_array_index_type,
loopse->loop->from[n], tmp); loopse->loop->from[n], tmp);
offset = fold_build2 (MINUS_EXPR, gfc_array_index_type, offset = fold_build2 (MINUS_EXPR, gfc_array_index_type,
offset, tmp); offset, tmp);
} }
info->offset = gfc_create_var (gfc_array_index_type, NULL); info->offset = gfc_create_var (gfc_array_index_type, NULL);
gfc_add_modify (&se->pre, info->offset, offset); gfc_add_modify (&se->pre, info->offset, offset);
/* Copy the result back using unpack. */ /* Copy the result back using unpack. */
tmp = build_call_expr (gfor_fndecl_in_unpack, 2, parmse.expr, data); tmp = build_call_expr_loc (input_location,
gfor_fndecl_in_unpack, 2, parmse.expr, data);
gfc_add_expr_to_block (&se->post, tmp); gfc_add_expr_to_block (&se->post, tmp);
/* parmse.pre is already added above. */ /* parmse.pre is already added above. */
@ -539,12 +540,14 @@ gfc_trans_pause (gfc_code * code)
if (code->expr1 == NULL) if (code->expr1 == NULL)
{ {
tmp = build_int_cst (gfc_int4_type_node, code->ext.stop_code); tmp = build_int_cst (gfc_int4_type_node, code->ext.stop_code);
tmp = build_call_expr (gfor_fndecl_pause_numeric, 1, tmp); tmp = build_call_expr_loc (input_location,
gfor_fndecl_pause_numeric, 1, tmp);
} }
else else
{ {
gfc_conv_expr_reference (&se, code->expr1); gfc_conv_expr_reference (&se, code->expr1);
tmp = build_call_expr (gfor_fndecl_pause_string, 2, tmp = build_call_expr_loc (input_location,
gfor_fndecl_pause_string, 2,
se.expr, se.string_length); se.expr, se.string_length);
} }
@ -574,12 +577,14 @@ gfc_trans_stop (gfc_code * code)
if (code->expr1 == NULL) if (code->expr1 == NULL)
{ {
tmp = build_int_cst (gfc_int4_type_node, code->ext.stop_code); tmp = build_int_cst (gfc_int4_type_node, code->ext.stop_code);
tmp = build_call_expr (gfor_fndecl_stop_numeric, 1, tmp); tmp = build_call_expr_loc (input_location,
gfor_fndecl_stop_numeric, 1, tmp);
} }
else else
{ {
gfc_conv_expr_reference (&se, code->expr1); gfc_conv_expr_reference (&se, code->expr1);
tmp = build_call_expr (gfor_fndecl_stop_string, 2, tmp = build_call_expr_loc (input_location,
gfor_fndecl_stop_string, 2,
se.expr, se.string_length); se.expr, se.string_length);
} }
@ -1614,7 +1619,8 @@ gfc_trans_character_select (gfc_code *code)
else else
gcc_unreachable (); gcc_unreachable ();
tmp = build_call_expr (fndecl, 4, init, build_int_cst (NULL_TREE, n), tmp = build_call_expr_loc (input_location,
fndecl, 4, init, build_int_cst (NULL_TREE, n),
se.expr, se.string_length); se.expr, se.string_length);
case_num = gfc_create_var (integer_type_node, "case_num"); case_num = gfc_create_var (integer_type_node, "case_num");
gfc_add_modify (&block, case_num, tmp); gfc_add_modify (&block, case_num, tmp);
@ -1741,7 +1747,7 @@ forall_make_variable_temp (gfc_code *c, stmtblock_t *pre, stmtblock_t *post)
gfc_conv_subref_array_arg (&tse, e, 0, INTENT_IN); gfc_conv_subref_array_arg (&tse, e, 0, INTENT_IN);
gfc_add_block_to_block (pre, &tse.pre); gfc_add_block_to_block (pre, &tse.pre);
gfc_add_block_to_block (post, &tse.post); gfc_add_block_to_block (post, &tse.post);
tse.expr = build_fold_indirect_ref (tse.expr); tse.expr = build_fold_indirect_ref_loc (input_location, tse.expr);
if (e->ts.type != BT_CHARACTER) if (e->ts.type != BT_CHARACTER)
{ {
@ -2441,7 +2447,7 @@ allocate_temp_for_forall_nest_1 (tree type, tree size, stmtblock_t * block,
tmp = gfc_do_allocate (bytesize, size, ptemp1, block, type); tmp = gfc_do_allocate (bytesize, size, ptemp1, block, type);
if (*ptemp1) if (*ptemp1)
tmp = build_fold_indirect_ref (tmp); tmp = build_fold_indirect_ref_loc (input_location, tmp);
return tmp; return tmp;
} }
@ -4020,7 +4026,7 @@ gfc_trans_allocate (gfc_code * code)
if (expr->ts.type == BT_DERIVED && expr->ts.derived->attr.alloc_comp) if (expr->ts.type == BT_DERIVED && expr->ts.derived->attr.alloc_comp)
{ {
tmp = build_fold_indirect_ref (se.expr); tmp = build_fold_indirect_ref_loc (input_location, se.expr);
tmp = gfc_nullify_alloc_comp (expr->ts.derived, tmp, 0); tmp = gfc_nullify_alloc_comp (expr->ts.derived, tmp, 0);
gfc_add_expr_to_block (&se.pre, tmp); gfc_add_expr_to_block (&se.pre, tmp);
} }
@ -4063,7 +4069,8 @@ gfc_trans_allocate (gfc_code * code)
dlen = gfc_get_expr_charlen (code->expr2); dlen = gfc_get_expr_charlen (code->expr2);
slen = fold_build2 (MIN_EXPR, TREE_TYPE (slen), dlen, slen); slen = fold_build2 (MIN_EXPR, TREE_TYPE (slen), dlen, slen);
dlen = build_call_expr (built_in_decls[BUILT_IN_MEMCPY], 3, dlen = build_call_expr_loc (input_location,
built_in_decls[BUILT_IN_MEMCPY], 3,
gfc_build_addr_expr (pvoid_type_node, se.expr), errmsg, slen); gfc_build_addr_expr (pvoid_type_node, se.expr), errmsg, slen);
tmp = fold_build2 (NE_EXPR, boolean_type_node, stat, tmp = fold_build2 (NE_EXPR, boolean_type_node, stat,
@ -4197,7 +4204,8 @@ gfc_trans_deallocate (gfc_code *code)
dlen = gfc_get_expr_charlen (code->expr2); dlen = gfc_get_expr_charlen (code->expr2);
slen = fold_build2 (MIN_EXPR, TREE_TYPE (slen), dlen, slen); slen = fold_build2 (MIN_EXPR, TREE_TYPE (slen), dlen, slen);
dlen = build_call_expr (built_in_decls[BUILT_IN_MEMCPY], 3, dlen = build_call_expr_loc (input_location,
built_in_decls[BUILT_IN_MEMCPY], 3,
gfc_build_addr_expr (pvoid_type_node, se.expr), errmsg, slen); gfc_build_addr_expr (pvoid_type_node, se.expr), errmsg, slen);
tmp = fold_build2 (NE_EXPR, boolean_type_node, astat, tmp = fold_build2 (NE_EXPR, boolean_type_node, astat,

View File

@ -339,7 +339,7 @@ gfc_build_array_ref (tree base, tree offset, tree decl)
tmp, fold_convert (sizetype, offset)); tmp, fold_convert (sizetype, offset));
tmp = fold_convert (build_pointer_type (type), tmp); tmp = fold_convert (build_pointer_type (type), tmp);
if (!TYPE_STRING_FLAG (type)) if (!TYPE_STRING_FLAG (type))
tmp = build_fold_indirect_ref (tmp); tmp = build_fold_indirect_ref_loc (input_location, tmp);
return tmp; return tmp;
} }
else else
@ -413,13 +413,14 @@ gfc_trans_runtime_error_vararg (bool error, locus* where, const char* msgid,
va_end (ap); va_end (ap);
/* Build the function call to runtime_(warning,error)_at; because of the /* Build the function call to runtime_(warning,error)_at; because of the
variable number of arguments, we can't use build_call_expr directly. */ variable number of arguments, we can't use build_call_expr_loc dinput_location,
irectly. */
if (error) if (error)
fntype = TREE_TYPE (gfor_fndecl_runtime_error_at); fntype = TREE_TYPE (gfor_fndecl_runtime_error_at);
else else
fntype = TREE_TYPE (gfor_fndecl_runtime_warning_at); fntype = TREE_TYPE (gfor_fndecl_runtime_warning_at);
tmp = fold_builtin_call_array (TREE_TYPE (fntype), tmp = fold_builtin_call_array (input_location, TREE_TYPE (fntype),
fold_build1 (ADDR_EXPR, fold_build1 (ADDR_EXPR,
build_pointer_type (fntype), build_pointer_type (fntype),
error error
@ -482,7 +483,8 @@ gfc_trans_runtime_check (bool error, bool once, tree cond, stmtblock_t * pblock,
cond = fold_convert (long_integer_type_node, cond); cond = fold_convert (long_integer_type_node, cond);
tmp = build_int_cst (long_integer_type_node, 0); tmp = build_int_cst (long_integer_type_node, 0);
cond = build_call_expr (built_in_decls[BUILT_IN_EXPECT], 2, cond, tmp); cond = build_call_expr_loc (input_location,
built_in_decls[BUILT_IN_EXPECT], 2, cond, tmp);
cond = fold_convert (boolean_type_node, cond); cond = fold_convert (boolean_type_node, cond);
tmp = build3_v (COND_EXPR, cond, body, build_empty_stmt (input_location)); tmp = build3_v (COND_EXPR, cond, body, build_empty_stmt (input_location));
@ -515,7 +517,8 @@ gfc_call_malloc (stmtblock_t * block, tree type, tree size)
msg = gfc_build_addr_expr (pchar_type_node, gfc_build_localized_cstring_const msg = gfc_build_addr_expr (pchar_type_node, gfc_build_localized_cstring_const
("Attempt to allocate a negative amount of memory.")); ("Attempt to allocate a negative amount of memory."));
tmp = fold_build3 (COND_EXPR, void_type_node, negative, tmp = fold_build3 (COND_EXPR, void_type_node, negative,
build_call_expr (gfor_fndecl_runtime_error, 1, msg), build_call_expr_loc (input_location,
gfor_fndecl_runtime_error, 1, msg),
build_empty_stmt (input_location)); build_empty_stmt (input_location));
gfc_add_expr_to_block (block, tmp); gfc_add_expr_to_block (block, tmp);
@ -526,14 +529,16 @@ gfc_call_malloc (stmtblock_t * block, tree type, tree size)
build_int_cst (size_type_node, 1)); build_int_cst (size_type_node, 1));
gfc_add_modify (&block2, res, gfc_add_modify (&block2, res,
build_call_expr (built_in_decls[BUILT_IN_MALLOC], 1, build_call_expr_loc (input_location,
built_in_decls[BUILT_IN_MALLOC], 1,
size)); size));
null_result = fold_build2 (EQ_EXPR, boolean_type_node, res, null_result = fold_build2 (EQ_EXPR, boolean_type_node, res,
build_int_cst (pvoid_type_node, 0)); build_int_cst (pvoid_type_node, 0));
msg = gfc_build_addr_expr (pchar_type_node, gfc_build_localized_cstring_const msg = gfc_build_addr_expr (pchar_type_node, gfc_build_localized_cstring_const
("Memory allocation failed")); ("Memory allocation failed"));
tmp = fold_build3 (COND_EXPR, void_type_node, null_result, tmp = fold_build3 (COND_EXPR, void_type_node, null_result,
build_call_expr (gfor_fndecl_os_error, 1, msg), build_call_expr_loc (input_location,
gfor_fndecl_os_error, 1, msg),
build_empty_stmt (input_location)); build_empty_stmt (input_location));
gfc_add_expr_to_block (&block2, tmp); gfc_add_expr_to_block (&block2, tmp);
malloc_result = gfc_finish_block (&block2); malloc_result = gfc_finish_block (&block2);
@ -615,7 +620,8 @@ gfc_allocate_with_status (stmtblock_t * block, tree size, tree status)
msg = gfc_build_addr_expr (pchar_type_node, gfc_build_localized_cstring_const msg = gfc_build_addr_expr (pchar_type_node, gfc_build_localized_cstring_const
("Attempt to allocate negative amount of memory. " ("Attempt to allocate negative amount of memory. "
"Possible integer overflow")); "Possible integer overflow"));
error = build_call_expr (gfor_fndecl_runtime_error, 1, msg); error = build_call_expr_loc (input_location,
gfor_fndecl_runtime_error, 1, msg);
if (status != NULL_TREE && !integer_zerop (status)) if (status != NULL_TREE && !integer_zerop (status))
{ {
@ -624,7 +630,7 @@ gfc_allocate_with_status (stmtblock_t * block, tree size, tree status)
gfc_start_block (&set_status_block); gfc_start_block (&set_status_block);
gfc_add_modify (&set_status_block, gfc_add_modify (&set_status_block,
fold_build1 (INDIRECT_REF, status_type, status), fold_build1 (INDIRECT_REF, status_type, status),
build_int_cst (status_type, LIBERROR_ALLOCATION)); build_int_cst (status_type, LIBERROR_ALLOCATION));
gfc_add_modify (&set_status_block, res, gfc_add_modify (&set_status_block, res,
build_int_cst (pvoid_type_node, 0)); build_int_cst (pvoid_type_node, 0));
@ -638,14 +644,16 @@ gfc_allocate_with_status (stmtblock_t * block, tree size, tree status)
/* The allocation itself. */ /* The allocation itself. */
gfc_start_block (&alloc_block); gfc_start_block (&alloc_block);
gfc_add_modify (&alloc_block, res, gfc_add_modify (&alloc_block, res,
build_call_expr (built_in_decls[BUILT_IN_MALLOC], 1, build_call_expr_loc (input_location,
built_in_decls[BUILT_IN_MALLOC], 1,
fold_build2 (MAX_EXPR, size_type_node, fold_build2 (MAX_EXPR, size_type_node,
size, size,
build_int_cst (size_type_node, 1)))); build_int_cst (size_type_node, 1))));
msg = gfc_build_addr_expr (pchar_type_node, gfc_build_localized_cstring_const msg = gfc_build_addr_expr (pchar_type_node, gfc_build_localized_cstring_const
("Out of memory")); ("Out of memory"));
tmp = build_call_expr (gfor_fndecl_os_error, 1, msg); tmp = build_call_expr_loc (input_location,
gfor_fndecl_os_error, 1, msg);
if (status != NULL_TREE && !integer_zerop (status)) if (status != NULL_TREE && !integer_zerop (status))
{ {
@ -750,7 +758,8 @@ gfc_allocate_array_with_status (stmtblock_t * block, tree mem, tree size,
stmtblock_t set_status_block; stmtblock_t set_status_block;
gfc_start_block (&set_status_block); gfc_start_block (&set_status_block);
tmp = build_call_expr (built_in_decls[BUILT_IN_FREE], 1, tmp = build_call_expr_loc (input_location,
built_in_decls[BUILT_IN_FREE], 1,
fold_convert (pvoid_type_node, mem)); fold_convert (pvoid_type_node, mem));
gfc_add_expr_to_block (&set_status_block, tmp); gfc_add_expr_to_block (&set_status_block, tmp);
@ -788,7 +797,8 @@ gfc_call_free (tree var)
var = gfc_evaluate_now (var, &block); var = gfc_evaluate_now (var, &block);
cond = fold_build2 (NE_EXPR, boolean_type_node, var, cond = fold_build2 (NE_EXPR, boolean_type_node, var,
build_int_cst (pvoid_type_node, 0)); build_int_cst (pvoid_type_node, 0));
call = build_call_expr (built_in_decls[BUILT_IN_FREE], 1, var); call = build_call_expr_loc (input_location,
built_in_decls[BUILT_IN_FREE], 1, var);
tmp = fold_build3 (COND_EXPR, void_type_node, cond, call, tmp = fold_build3 (COND_EXPR, void_type_node, cond, call,
build_empty_stmt (input_location)); build_empty_stmt (input_location));
gfc_add_expr_to_block (&block, tmp); gfc_add_expr_to_block (&block, tmp);
@ -873,7 +883,8 @@ gfc_deallocate_with_status (tree pointer, tree status, bool can_fail,
/* When POINTER is not NULL, we free it. */ /* When POINTER is not NULL, we free it. */
gfc_start_block (&non_null); gfc_start_block (&non_null);
tmp = build_call_expr (built_in_decls[BUILT_IN_FREE], 1, tmp = build_call_expr_loc (input_location,
built_in_decls[BUILT_IN_FREE], 1,
fold_convert (pvoid_type_node, pointer)); fold_convert (pvoid_type_node, pointer));
gfc_add_expr_to_block (&non_null, tmp); gfc_add_expr_to_block (&non_null, tmp);
@ -935,12 +946,14 @@ gfc_call_realloc (stmtblock_t * block, tree mem, tree size)
msg = gfc_build_addr_expr (pchar_type_node, gfc_build_localized_cstring_const msg = gfc_build_addr_expr (pchar_type_node, gfc_build_localized_cstring_const
("Attempt to allocate a negative amount of memory.")); ("Attempt to allocate a negative amount of memory."));
tmp = fold_build3 (COND_EXPR, void_type_node, negative, tmp = fold_build3 (COND_EXPR, void_type_node, negative,
build_call_expr (gfor_fndecl_runtime_error, 1, msg), build_call_expr_loc (input_location,
gfor_fndecl_runtime_error, 1, msg),
build_empty_stmt (input_location)); build_empty_stmt (input_location));
gfc_add_expr_to_block (block, tmp); gfc_add_expr_to_block (block, tmp);
/* Call realloc and check the result. */ /* Call realloc and check the result. */
tmp = build_call_expr (built_in_decls[BUILT_IN_REALLOC], 2, tmp = build_call_expr_loc (input_location,
built_in_decls[BUILT_IN_REALLOC], 2,
fold_convert (pvoid_type_node, mem), size); fold_convert (pvoid_type_node, mem), size);
gfc_add_modify (block, res, fold_convert (type, tmp)); gfc_add_modify (block, res, fold_convert (type, tmp));
null_result = fold_build2 (EQ_EXPR, boolean_type_node, res, null_result = fold_build2 (EQ_EXPR, boolean_type_node, res,
@ -952,7 +965,8 @@ gfc_call_realloc (stmtblock_t * block, tree mem, tree size)
msg = gfc_build_addr_expr (pchar_type_node, gfc_build_localized_cstring_const msg = gfc_build_addr_expr (pchar_type_node, gfc_build_localized_cstring_const
("Out of memory")); ("Out of memory"));
tmp = fold_build3 (COND_EXPR, void_type_node, null_result, tmp = fold_build3 (COND_EXPR, void_type_node, null_result,
build_call_expr (gfor_fndecl_os_error, 1, msg), build_call_expr_loc (input_location,
gfor_fndecl_os_error, 1, msg),
build_empty_stmt (input_location)); build_empty_stmt (input_location));
gfc_add_expr_to_block (block, tmp); gfc_add_expr_to_block (block, tmp);

View File

@ -813,16 +813,16 @@ lower_builtin_setjmp (gimple_stmt_iterator *gsi)
arg = build_addr (next_label, current_function_decl); arg = build_addr (next_label, current_function_decl);
t = implicit_built_in_decls[BUILT_IN_SETJMP_SETUP]; t = implicit_built_in_decls[BUILT_IN_SETJMP_SETUP];
g = gimple_build_call (t, 2, gimple_call_arg (stmt, 0), arg); g = gimple_build_call (t, 2, gimple_call_arg (stmt, 0), arg);
gimple_set_location (g, gimple_location (stmt)); gimple_set_location (g, loc);
gimple_set_block (g, gimple_block (stmt)); gimple_set_block (g, gimple_block (stmt));
gsi_insert_before (gsi, g, GSI_SAME_STMT); gsi_insert_before (gsi, g, GSI_SAME_STMT);
/* Build 'DEST = 0' and insert. */ /* Build 'DEST = 0' and insert. */
if (dest) if (dest)
{ {
g = gimple_build_assign (dest, fold_convert (TREE_TYPE (dest), g = gimple_build_assign (dest, fold_convert_loc (loc, TREE_TYPE (dest),
integer_zero_node)); integer_zero_node));
gimple_set_location (g, gimple_location (stmt)); gimple_set_location (g, loc);
gimple_set_block (g, gimple_block (stmt)); gimple_set_block (g, gimple_block (stmt));
gsi_insert_before (gsi, g, GSI_SAME_STMT); gsi_insert_before (gsi, g, GSI_SAME_STMT);
} }
@ -839,16 +839,16 @@ lower_builtin_setjmp (gimple_stmt_iterator *gsi)
arg = build_addr (next_label, current_function_decl); arg = build_addr (next_label, current_function_decl);
t = implicit_built_in_decls[BUILT_IN_SETJMP_RECEIVER]; t = implicit_built_in_decls[BUILT_IN_SETJMP_RECEIVER];
g = gimple_build_call (t, 1, arg); g = gimple_build_call (t, 1, arg);
gimple_set_location (g, gimple_location (stmt)); gimple_set_location (g, loc);
gimple_set_block (g, gimple_block (stmt)); gimple_set_block (g, gimple_block (stmt));
gsi_insert_before (gsi, g, GSI_SAME_STMT); gsi_insert_before (gsi, g, GSI_SAME_STMT);
/* Build 'DEST = 1' and insert. */ /* Build 'DEST = 1' and insert. */
if (dest) if (dest)
{ {
g = gimple_build_assign (dest, fold_convert (TREE_TYPE (dest), g = gimple_build_assign (dest, fold_convert_loc (loc, TREE_TYPE (dest),
integer_one_node)); integer_one_node));
gimple_set_location (g, gimple_location (stmt)); gimple_set_location (g, loc);
gimple_set_block (g, gimple_block (stmt)); gimple_set_block (g, gimple_block (stmt));
gsi_insert_before (gsi, g, GSI_SAME_STMT); gsi_insert_before (gsi, g, GSI_SAME_STMT);
} }

View File

@ -487,6 +487,7 @@ void
gimple_cond_get_ops_from_tree (tree cond, enum tree_code *code_p, gimple_cond_get_ops_from_tree (tree cond, enum tree_code *code_p,
tree *lhs_p, tree *rhs_p) tree *lhs_p, tree *rhs_p)
{ {
location_t loc = EXPR_LOCATION (cond);
gcc_assert (TREE_CODE_CLASS (TREE_CODE (cond)) == tcc_comparison gcc_assert (TREE_CODE_CLASS (TREE_CODE (cond)) == tcc_comparison
|| TREE_CODE (cond) == TRUTH_NOT_EXPR || TREE_CODE (cond) == TRUTH_NOT_EXPR
|| is_gimple_min_invariant (cond) || is_gimple_min_invariant (cond)
@ -499,14 +500,14 @@ gimple_cond_get_ops_from_tree (tree cond, enum tree_code *code_p,
{ {
*code_p = EQ_EXPR; *code_p = EQ_EXPR;
gcc_assert (*lhs_p && *rhs_p == NULL_TREE); gcc_assert (*lhs_p && *rhs_p == NULL_TREE);
*rhs_p = fold_convert (TREE_TYPE (*lhs_p), integer_zero_node); *rhs_p = fold_convert_loc (loc, TREE_TYPE (*lhs_p), integer_zero_node);
} }
/* Canonicalize conditionals of the form 'if (VAL)' */ /* Canonicalize conditionals of the form 'if (VAL)' */
else if (TREE_CODE_CLASS (*code_p) != tcc_comparison) else if (TREE_CODE_CLASS (*code_p) != tcc_comparison)
{ {
*code_p = NE_EXPR; *code_p = NE_EXPR;
gcc_assert (*lhs_p && *rhs_p == NULL_TREE); gcc_assert (*lhs_p && *rhs_p == NULL_TREE);
*rhs_p = fold_convert (TREE_TYPE (*lhs_p), integer_zero_node); *rhs_p = fold_convert_loc (loc, TREE_TYPE (*lhs_p), integer_zero_node);
} }
} }
@ -1897,10 +1898,11 @@ gimple_set_bb (gimple stmt, basic_block bb)
tree tree
gimple_fold (const_gimple stmt) gimple_fold (const_gimple stmt)
{ {
location_t loc = gimple_location (stmt);
switch (gimple_code (stmt)) switch (gimple_code (stmt))
{ {
case GIMPLE_COND: case GIMPLE_COND:
return fold_binary (gimple_cond_code (stmt), return fold_binary_loc (loc, gimple_cond_code (stmt),
boolean_type_node, boolean_type_node,
gimple_cond_lhs (stmt), gimple_cond_lhs (stmt),
gimple_cond_rhs (stmt)); gimple_cond_rhs (stmt));
@ -1909,11 +1911,11 @@ gimple_fold (const_gimple stmt)
switch (get_gimple_rhs_class (gimple_assign_rhs_code (stmt))) switch (get_gimple_rhs_class (gimple_assign_rhs_code (stmt)))
{ {
case GIMPLE_UNARY_RHS: case GIMPLE_UNARY_RHS:
return fold_unary (gimple_assign_rhs_code (stmt), return fold_unary_loc (loc, gimple_assign_rhs_code (stmt),
TREE_TYPE (gimple_assign_lhs (stmt)), TREE_TYPE (gimple_assign_lhs (stmt)),
gimple_assign_rhs1 (stmt)); gimple_assign_rhs1 (stmt));
case GIMPLE_BINARY_RHS: case GIMPLE_BINARY_RHS:
return fold_binary (gimple_assign_rhs_code (stmt), return fold_binary_loc (loc, gimple_assign_rhs_code (stmt),
TREE_TYPE (gimple_assign_lhs (stmt)), TREE_TYPE (gimple_assign_lhs (stmt)),
gimple_assign_rhs1 (stmt), gimple_assign_rhs1 (stmt),
gimple_assign_rhs2 (stmt)); gimple_assign_rhs2 (stmt));

View File

@ -1884,7 +1884,7 @@ gimple_call_set_fndecl (gimple gs, tree decl)
{ {
GIMPLE_CHECK (gs, GIMPLE_CALL); GIMPLE_CHECK (gs, GIMPLE_CALL);
gcc_assert (TREE_CODE (decl) == FUNCTION_DECL); gcc_assert (TREE_CODE (decl) == FUNCTION_DECL);
gimple_set_op (gs, 1, build_fold_addr_expr (decl)); gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
} }

View File

@ -1786,6 +1786,7 @@ static enum gimplify_status
gimplify_conversion (tree *expr_p) gimplify_conversion (tree *expr_p)
{ {
tree tem; tree tem;
location_t loc = EXPR_LOCATION (*expr_p);
gcc_assert (CONVERT_EXPR_P (*expr_p)); gcc_assert (CONVERT_EXPR_P (*expr_p));
/* Then strip away all but the outermost conversion. */ /* Then strip away all but the outermost conversion. */
@ -1827,7 +1828,7 @@ gimplify_conversion (tree *expr_p)
/* If we have a conversion to a non-register type force the /* If we have a conversion to a non-register type force the
use of a VIEW_CONVERT_EXPR instead. */ use of a VIEW_CONVERT_EXPR instead. */
if (!is_gimple_reg_type (TREE_TYPE (*expr_p))) if (!is_gimple_reg_type (TREE_TYPE (*expr_p)))
*expr_p = fold_build1 (VIEW_CONVERT_EXPR, TREE_TYPE (*expr_p), *expr_p = fold_build1_loc (loc, VIEW_CONVERT_EXPR, TREE_TYPE (*expr_p),
TREE_OPERAND (*expr_p, 0)); TREE_OPERAND (*expr_p, 0));
return GS_OK; return GS_OK;
@ -1933,6 +1934,7 @@ gimplify_compound_lval (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
VEC(tree,heap) *stack; VEC(tree,heap) *stack;
enum gimplify_status ret = GS_OK, tret; enum gimplify_status ret = GS_OK, tret;
int i; int i;
location_t loc = EXPR_LOCATION (*expr_p);
/* Create a stack of the subexpressions so later we can walk them in /* Create a stack of the subexpressions so later we can walk them in
order from inner to outer. */ order from inner to outer. */
@ -1944,7 +1946,7 @@ gimplify_compound_lval (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
restart: restart:
/* Fold INDIRECT_REFs now to turn them into ARRAY_REFs. */ /* Fold INDIRECT_REFs now to turn them into ARRAY_REFs. */
if (TREE_CODE (*p) == INDIRECT_REF) if (TREE_CODE (*p) == INDIRECT_REF)
*p = fold_indirect_ref (*p); *p = fold_indirect_ref_loc (loc, *p);
if (handled_component_p (*p)) if (handled_component_p (*p))
; ;
@ -2003,7 +2005,7 @@ gimplify_compound_lval (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
/* Divide the element size by the alignment of the element /* Divide the element size by the alignment of the element
type (above). */ type (above). */
elmt_size = size_binop (EXACT_DIV_EXPR, elmt_size, factor); elmt_size = size_binop_loc (loc, EXACT_DIV_EXPR, elmt_size, factor);
if (!is_gimple_min_invariant (elmt_size)) if (!is_gimple_min_invariant (elmt_size))
{ {
@ -2026,7 +2028,7 @@ gimplify_compound_lval (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
= size_int (DECL_OFFSET_ALIGN (field) / BITS_PER_UNIT); = size_int (DECL_OFFSET_ALIGN (field) / BITS_PER_UNIT);
/* Divide the offset by its alignment. */ /* Divide the offset by its alignment. */
offset = size_binop (EXACT_DIV_EXPR, offset, factor); offset = size_binop_loc (loc, EXACT_DIV_EXPR, offset, factor);
if (!is_gimple_min_invariant (offset)) if (!is_gimple_min_invariant (offset))
{ {
@ -2116,6 +2118,7 @@ gimplify_self_mod_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
bool postfix; bool postfix;
enum tree_code arith_code; enum tree_code arith_code;
enum gimplify_status ret; enum gimplify_status ret;
location_t loc = EXPR_LOCATION (*expr_p);
code = TREE_CODE (*expr_p); code = TREE_CODE (*expr_p);
@ -2159,9 +2162,9 @@ gimplify_self_mod_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
if (!is_gimple_min_lval (lvalue)) if (!is_gimple_min_lval (lvalue))
{ {
mark_addressable (lvalue); mark_addressable (lvalue);
lvalue = build_fold_addr_expr (lvalue); lvalue = build_fold_addr_expr_loc (input_location, lvalue);
gimplify_expr (&lvalue, pre_p, post_p, is_gimple_val, fb_rvalue); gimplify_expr (&lvalue, pre_p, post_p, is_gimple_val, fb_rvalue);
lvalue = build_fold_indirect_ref (lvalue); lvalue = build_fold_indirect_ref_loc (input_location, lvalue);
} }
ret = gimplify_expr (&lhs, pre_p, post_p, is_gimple_val, fb_rvalue); ret = gimplify_expr (&lhs, pre_p, post_p, is_gimple_val, fb_rvalue);
if (ret == GS_ERROR) if (ret == GS_ERROR)
@ -2171,9 +2174,9 @@ gimplify_self_mod_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
/* For POINTERs increment, use POINTER_PLUS_EXPR. */ /* For POINTERs increment, use POINTER_PLUS_EXPR. */
if (POINTER_TYPE_P (TREE_TYPE (lhs))) if (POINTER_TYPE_P (TREE_TYPE (lhs)))
{ {
rhs = fold_convert (sizetype, rhs); rhs = fold_convert_loc (loc, sizetype, rhs);
if (arith_code == MINUS_EXPR) if (arith_code == MINUS_EXPR)
rhs = fold_build1 (NEGATE_EXPR, TREE_TYPE (rhs), rhs); rhs = fold_build1_loc (loc, NEGATE_EXPR, TREE_TYPE (rhs), rhs);
arith_code = POINTER_PLUS_EXPR; arith_code = POINTER_PLUS_EXPR;
} }
@ -2268,6 +2271,7 @@ gimplify_call_expr (tree *expr_p, gimple_seq *pre_p, bool want_value)
int i, nargs; int i, nargs;
gimple call; gimple call;
bool builtin_va_start_p = FALSE; bool builtin_va_start_p = FALSE;
location_t loc = EXPR_LOCATION (*expr_p);
gcc_assert (TREE_CODE (*expr_p) == CALL_EXPR); gcc_assert (TREE_CODE (*expr_p) == CALL_EXPR);
@ -2291,7 +2295,7 @@ gimplify_call_expr (tree *expr_p, gimple_seq *pre_p, bool want_value)
fndecl = get_callee_fndecl (*expr_p); fndecl = get_callee_fndecl (*expr_p);
if (fndecl && DECL_BUILT_IN (fndecl)) if (fndecl && DECL_BUILT_IN (fndecl))
{ {
tree new_tree = fold_call_expr (*expr_p, !want_value); tree new_tree = fold_call_expr (input_location, *expr_p, !want_value);
if (new_tree && new_tree != *expr_p) if (new_tree && new_tree != *expr_p)
{ {
@ -2364,8 +2368,9 @@ gimplify_call_expr (tree *expr_p, gimple_seq *pre_p, bool want_value)
tree call = *expr_p; tree call = *expr_p;
--nargs; --nargs;
*expr_p = build_call_array (TREE_TYPE (call), CALL_EXPR_FN (call), *expr_p = build_call_array_loc (loc, TREE_TYPE (call),
nargs, CALL_EXPR_ARGP (call)); CALL_EXPR_FN (call),
nargs, CALL_EXPR_ARGP (call));
/* Copy all CALL_EXPR flags, location and block, except /* Copy all CALL_EXPR flags, location and block, except
CALL_EXPR_VA_ARG_PACK flag. */ CALL_EXPR_VA_ARG_PACK flag. */
@ -2408,7 +2413,7 @@ gimplify_call_expr (tree *expr_p, gimple_seq *pre_p, bool want_value)
/* Try this again in case gimplification exposed something. */ /* Try this again in case gimplification exposed something. */
if (ret != GS_ERROR) if (ret != GS_ERROR)
{ {
tree new_tree = fold_call_expr (*expr_p, !want_value); tree new_tree = fold_call_expr (input_location, *expr_p, !want_value);
if (new_tree && new_tree != *expr_p) if (new_tree && new_tree != *expr_p)
{ {
@ -2749,6 +2754,7 @@ tree
gimple_boolify (tree expr) gimple_boolify (tree expr)
{ {
tree type = TREE_TYPE (expr); tree type = TREE_TYPE (expr);
location_t loc = EXPR_LOCATION (expr);
if (TREE_CODE (type) == BOOLEAN_TYPE) if (TREE_CODE (type) == BOOLEAN_TYPE)
return expr; return expr;
@ -2777,7 +2783,7 @@ gimple_boolify (tree expr)
default: default:
/* Other expressions that get here must have boolean values, but /* Other expressions that get here must have boolean values, but
might need to be converted to the appropriate mode. */ might need to be converted to the appropriate mode. */
return fold_convert (boolean_type_node, expr); return fold_convert_loc (loc, boolean_type_node, expr);
} }
} }
@ -2860,6 +2866,7 @@ gimplify_cond_expr (tree *expr_p, gimple_seq *pre_p, fallback_t fallback)
gimple gimple_cond; gimple gimple_cond;
enum tree_code pred_code; enum tree_code pred_code;
gimple_seq seq = NULL; gimple_seq seq = NULL;
location_t loc = EXPR_LOCATION (*expr_p);
type = TREE_TYPE (expr); type = TREE_TYPE (expr);
@ -2893,18 +2900,18 @@ gimplify_cond_expr (tree *expr_p, gimple_seq *pre_p, fallback_t fallback)
if (TREE_TYPE (TREE_OPERAND (expr, 1)) != void_type_node) if (TREE_TYPE (TREE_OPERAND (expr, 1)) != void_type_node)
TREE_OPERAND (expr, 1) = TREE_OPERAND (expr, 1) =
build_fold_addr_expr (TREE_OPERAND (expr, 1)); build_fold_addr_expr_loc (loc, TREE_OPERAND (expr, 1));
if (TREE_TYPE (TREE_OPERAND (expr, 2)) != void_type_node) if (TREE_TYPE (TREE_OPERAND (expr, 2)) != void_type_node)
TREE_OPERAND (expr, 2) = TREE_OPERAND (expr, 2) =
build_fold_addr_expr (TREE_OPERAND (expr, 2)); build_fold_addr_expr_loc (loc, TREE_OPERAND (expr, 2));
tmp = create_tmp_var (type, "iftmp"); tmp = create_tmp_var (type, "iftmp");
expr = build3 (COND_EXPR, void_type_node, TREE_OPERAND (expr, 0), expr = build3 (COND_EXPR, void_type_node, TREE_OPERAND (expr, 0),
TREE_OPERAND (expr, 1), TREE_OPERAND (expr, 2)); TREE_OPERAND (expr, 1), TREE_OPERAND (expr, 2));
result = build_fold_indirect_ref (tmp); result = build_fold_indirect_ref_loc (loc, tmp);
} }
/* Build the then clause, 't1 = a;'. But don't build an assignment /* Build the then clause, 't1 = a;'. But don't build an assignment
@ -3083,17 +3090,18 @@ gimplify_modify_expr_to_memcpy (tree *expr_p, tree size, bool want_value,
{ {
tree t, to, to_ptr, from, from_ptr; tree t, to, to_ptr, from, from_ptr;
gimple gs; gimple gs;
location_t loc = EXPR_LOCATION (*expr_p);
to = TREE_OPERAND (*expr_p, 0); to = TREE_OPERAND (*expr_p, 0);
from = TREE_OPERAND (*expr_p, 1); from = TREE_OPERAND (*expr_p, 1);
mark_addressable (from); mark_addressable (from);
from_ptr = build_fold_addr_expr (from); from_ptr = build_fold_addr_expr_loc (loc, from);
gimplify_arg (&from_ptr, seq_p, EXPR_LOCATION (*expr_p)); gimplify_arg (&from_ptr, seq_p, loc);
mark_addressable (to); mark_addressable (to);
to_ptr = build_fold_addr_expr (to); to_ptr = build_fold_addr_expr_loc (loc, to);
gimplify_arg (&to_ptr, seq_p, EXPR_LOCATION (*expr_p)); gimplify_arg (&to_ptr, seq_p, loc);
t = implicit_built_in_decls[BUILT_IN_MEMCPY]; t = implicit_built_in_decls[BUILT_IN_MEMCPY];
@ -3125,6 +3133,7 @@ gimplify_modify_expr_to_memset (tree *expr_p, tree size, bool want_value,
{ {
tree t, from, to, to_ptr; tree t, from, to, to_ptr;
gimple gs; gimple gs;
location_t loc = EXPR_LOCATION (*expr_p);
/* Assert our assumptions, to abort instead of producing wrong code /* Assert our assumptions, to abort instead of producing wrong code
silently if they are not met. Beware that the RHS CONSTRUCTOR might silently if they are not met. Beware that the RHS CONSTRUCTOR might
@ -3139,8 +3148,8 @@ gimplify_modify_expr_to_memset (tree *expr_p, tree size, bool want_value,
/* Now proceed. */ /* Now proceed. */
to = TREE_OPERAND (*expr_p, 0); to = TREE_OPERAND (*expr_p, 0);
to_ptr = build_fold_addr_expr (to); to_ptr = build_fold_addr_expr_loc (loc, to);
gimplify_arg (&to_ptr, seq_p, EXPR_LOCATION (*expr_p)); gimplify_arg (&to_ptr, seq_p, loc);
t = implicit_built_in_decls[BUILT_IN_MEMSET]; t = implicit_built_in_decls[BUILT_IN_MEMSET];
gs = gimple_build_call (t, 3, to_ptr, integer_zero_node, size); gs = gimple_build_call (t, 3, to_ptr, integer_zero_node, size);
@ -4296,6 +4305,7 @@ gimplify_modify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
tree *to_p = &TREE_OPERAND (*expr_p, 0); tree *to_p = &TREE_OPERAND (*expr_p, 0);
enum gimplify_status ret = GS_UNHANDLED; enum gimplify_status ret = GS_UNHANDLED;
gimple assign; gimple assign;
location_t loc = EXPR_LOCATION (*expr_p);
gcc_assert (TREE_CODE (*expr_p) == MODIFY_EXPR gcc_assert (TREE_CODE (*expr_p) == MODIFY_EXPR
|| TREE_CODE (*expr_p) == INIT_EXPR); || TREE_CODE (*expr_p) == INIT_EXPR);
@ -4308,7 +4318,7 @@ gimplify_modify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
{ {
STRIP_USELESS_TYPE_CONVERSION (*from_p); STRIP_USELESS_TYPE_CONVERSION (*from_p);
if (!useless_type_conversion_p (TREE_TYPE (*to_p), TREE_TYPE (*from_p))) if (!useless_type_conversion_p (TREE_TYPE (*to_p), TREE_TYPE (*from_p)))
*from_p = fold_convert (TREE_TYPE (*to_p), *from_p); *from_p = fold_convert_loc (loc, TREE_TYPE (*to_p), *from_p);
} }
/* See if any simplifications can be done based on what the RHS is. */ /* See if any simplifications can be done based on what the RHS is. */
@ -4450,14 +4460,15 @@ gimplify_variable_sized_compare (tree *expr_p)
tree op0 = TREE_OPERAND (*expr_p, 0); tree op0 = TREE_OPERAND (*expr_p, 0);
tree op1 = TREE_OPERAND (*expr_p, 1); tree op1 = TREE_OPERAND (*expr_p, 1);
tree t, arg, dest, src; tree t, arg, dest, src;
location_t loc = EXPR_LOCATION (*expr_p);
arg = TYPE_SIZE_UNIT (TREE_TYPE (op0)); arg = TYPE_SIZE_UNIT (TREE_TYPE (op0));
arg = unshare_expr (arg); arg = unshare_expr (arg);
arg = SUBSTITUTE_PLACEHOLDER_IN_EXPR (arg, op0); arg = SUBSTITUTE_PLACEHOLDER_IN_EXPR (arg, op0);
src = build_fold_addr_expr (op1); src = build_fold_addr_expr_loc (loc, op1);
dest = build_fold_addr_expr (op0); dest = build_fold_addr_expr_loc (loc, op0);
t = implicit_built_in_decls[BUILT_IN_MEMCMP]; t = implicit_built_in_decls[BUILT_IN_MEMCMP];
t = build_call_expr (t, 3, dest, src, arg); t = build_call_expr_loc (loc, t, 3, dest, src, arg);
*expr_p *expr_p
= build2 (TREE_CODE (*expr_p), TREE_TYPE (*expr_p), t, integer_zero_node); = build2 (TREE_CODE (*expr_p), TREE_TYPE (*expr_p), t, integer_zero_node);
@ -4470,17 +4481,18 @@ gimplify_variable_sized_compare (tree *expr_p)
static enum gimplify_status static enum gimplify_status
gimplify_scalar_mode_aggregate_compare (tree *expr_p) gimplify_scalar_mode_aggregate_compare (tree *expr_p)
{ {
location_t loc = EXPR_LOCATION (*expr_p);
tree op0 = TREE_OPERAND (*expr_p, 0); tree op0 = TREE_OPERAND (*expr_p, 0);
tree op1 = TREE_OPERAND (*expr_p, 1); tree op1 = TREE_OPERAND (*expr_p, 1);
tree type = TREE_TYPE (op0); tree type = TREE_TYPE (op0);
tree scalar_type = lang_hooks.types.type_for_mode (TYPE_MODE (type), 1); tree scalar_type = lang_hooks.types.type_for_mode (TYPE_MODE (type), 1);
op0 = fold_build1 (VIEW_CONVERT_EXPR, scalar_type, op0); op0 = fold_build1_loc (loc, VIEW_CONVERT_EXPR, scalar_type, op0);
op1 = fold_build1 (VIEW_CONVERT_EXPR, scalar_type, op1); op1 = fold_build1_loc (loc, VIEW_CONVERT_EXPR, scalar_type, op1);
*expr_p *expr_p
= fold_build2 (TREE_CODE (*expr_p), TREE_TYPE (*expr_p), op0, op1); = fold_build2_loc (loc, TREE_CODE (*expr_p), TREE_TYPE (*expr_p), op0, op1);
return GS_OK; return GS_OK;
} }
@ -4502,8 +4514,8 @@ gimplify_boolean_expr (tree *expr_p, location_t locus)
tree type = TREE_TYPE (*expr_p); tree type = TREE_TYPE (*expr_p);
*expr_p = build3 (COND_EXPR, type, *expr_p, *expr_p = build3 (COND_EXPR, type, *expr_p,
fold_convert (type, boolean_true_node), fold_convert_loc (locus, type, boolean_true_node),
fold_convert (type, boolean_false_node)); fold_convert_loc (locus, type, boolean_false_node));
SET_EXPR_LOCATION (*expr_p, locus); SET_EXPR_LOCATION (*expr_p, locus);
@ -4607,6 +4619,7 @@ gimplify_addr_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
tree expr = *expr_p; tree expr = *expr_p;
tree op0 = TREE_OPERAND (expr, 0); tree op0 = TREE_OPERAND (expr, 0);
enum gimplify_status ret; enum gimplify_status ret;
location_t loc = EXPR_LOCATION (*expr_p);
switch (TREE_CODE (op0)) switch (TREE_CODE (op0))
{ {
@ -4628,7 +4641,7 @@ gimplify_addr_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
tree t_op00 = TREE_TYPE (op00); tree t_op00 = TREE_TYPE (op00);
if (!useless_type_conversion_p (t_expr, t_op00)) if (!useless_type_conversion_p (t_expr, t_op00))
op00 = fold_convert (TREE_TYPE (expr), op00); op00 = fold_convert_loc (loc, TREE_TYPE (expr), op00);
*expr_p = op00; *expr_p = op00;
ret = GS_OK; ret = GS_OK;
} }
@ -4647,8 +4660,9 @@ gimplify_addr_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
if (tree_ssa_useless_type_conversion (TREE_OPERAND (op0, 0))) if (tree_ssa_useless_type_conversion (TREE_OPERAND (op0, 0)))
op0 = TREE_OPERAND (op0, 0); op0 = TREE_OPERAND (op0, 0);
*expr_p = fold_convert (TREE_TYPE (expr), *expr_p = fold_convert_loc (loc, TREE_TYPE (expr),
build_fold_addr_expr (TREE_OPERAND (op0, 0))); build_fold_addr_expr_loc (loc,
TREE_OPERAND (op0, 0)));
ret = GS_OK; ret = GS_OK;
break; break;
@ -6556,7 +6570,7 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
break; break;
case INDIRECT_REF: case INDIRECT_REF:
*expr_p = fold_indirect_ref (*expr_p); *expr_p = fold_indirect_ref_loc (input_location, *expr_p);
if (*expr_p != save_expr) if (*expr_p != save_expr)
break; break;
/* else fall through. */ /* else fall through. */
@ -7161,7 +7175,7 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
/* An lvalue will do. Take the address of the expression, store it /* An lvalue will do. Take the address of the expression, store it
in a temporary, and replace the expression with an INDIRECT_REF of in a temporary, and replace the expression with an INDIRECT_REF of
that temporary. */ that temporary. */
tmp = build_fold_addr_expr (*expr_p); tmp = build_fold_addr_expr_loc (input_location, *expr_p);
gimplify_expr (&tmp, pre_p, post_p, is_gimple_reg, fb_rvalue); gimplify_expr (&tmp, pre_p, post_p, is_gimple_reg, fb_rvalue);
*expr_p = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (tmp)), tmp); *expr_p = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (tmp)), tmp);
} }

View File

@ -1,3 +1,10 @@
2009-07-17 Aldy Hernandez <aldyh@redhat.com>
Manuel López-Ibáñez <manu@gcc.gnu.org>
PR 40435
* objc-act.c: Add location argument to all calls to
build_fold_addr_expr.
2009-07-14 Taras Glek <tglek@mozilla.com> 2009-07-14 Taras Glek <tglek@mozilla.com>
Rafael Espindola <espindola@google.com> Rafael Espindola <espindola@google.com>

View File

@ -3554,7 +3554,7 @@ static tree
next_sjlj_build_try_exit (void) next_sjlj_build_try_exit (void)
{ {
tree t; tree t;
t = build_fold_addr_expr (cur_try_context->stack_decl); t = build_fold_addr_expr_loc (input_location, cur_try_context->stack_decl);
t = tree_cons (NULL, t, NULL); t = tree_cons (NULL, t, NULL);
t = build_function_call (input_location, t = build_function_call (input_location,
objc_exception_try_exit_decl, t); objc_exception_try_exit_decl, t);
@ -3575,14 +3575,14 @@ next_sjlj_build_enter_and_setjmp (void)
{ {
tree t, enter, sj, cond; tree t, enter, sj, cond;
t = build_fold_addr_expr (cur_try_context->stack_decl); t = build_fold_addr_expr_loc (input_location, cur_try_context->stack_decl);
t = tree_cons (NULL, t, NULL); t = tree_cons (NULL, t, NULL);
enter = build_function_call (input_location, enter = build_function_call (input_location,
objc_exception_try_enter_decl, t); objc_exception_try_enter_decl, t);
t = objc_build_component_ref (cur_try_context->stack_decl, t = objc_build_component_ref (cur_try_context->stack_decl,
get_identifier ("buf")); get_identifier ("buf"));
t = build_fold_addr_expr (t); t = build_fold_addr_expr_loc (input_location, t);
#ifdef OBJCPLUS #ifdef OBJCPLUS
/* Convert _setjmp argument to type that is expected. */ /* Convert _setjmp argument to type that is expected. */
if (TYPE_ARG_TYPES (TREE_TYPE (objc_setjmp_decl))) if (TYPE_ARG_TYPES (TREE_TYPE (objc_setjmp_decl)))
@ -3611,7 +3611,7 @@ next_sjlj_build_exc_extract (tree decl)
{ {
tree t; tree t;
t = build_fold_addr_expr (cur_try_context->stack_decl); t = build_fold_addr_expr_loc (input_location, cur_try_context->stack_decl);
t = tree_cons (NULL, t, NULL); t = tree_cons (NULL, t, NULL);
t = build_function_call (input_location, t = build_function_call (input_location,
objc_exception_extract_decl, t); objc_exception_extract_decl, t);
@ -6623,7 +6623,7 @@ build_objc_method_call (location_t loc, int super_flag, tree method_prototype,
method_params = tree_cons (NULL_TREE, lookup_object, method_params = tree_cons (NULL_TREE, lookup_object,
tree_cons (NULL_TREE, selector, tree_cons (NULL_TREE, selector,
method_params)); method_params));
method = build_fold_addr_expr (sender); method = build_fold_addr_expr_loc (input_location, sender);
} }
else else
{ {
@ -6637,8 +6637,7 @@ build_objc_method_call (location_t loc, int super_flag, tree method_prototype,
t = tree_cons (NULL_TREE, selector, NULL_TREE); t = tree_cons (NULL_TREE, selector, NULL_TREE);
t = tree_cons (NULL_TREE, lookup_object, t); t = tree_cons (NULL_TREE, lookup_object, t);
method = build_function_call (loc, method = build_function_call (loc, sender, t);
sender, t);
/* Pass the object to the method. */ /* Pass the object to the method. */
method_params = tree_cons (NULL_TREE, object, method_params = tree_cons (NULL_TREE, object,

View File

@ -222,6 +222,7 @@ extract_omp_for_data (gimple for_stmt, struct omp_for_data *fd,
struct omp_for_data_loop *loop; struct omp_for_data_loop *loop;
int i; int i;
struct omp_for_data_loop dummy_loop; struct omp_for_data_loop dummy_loop;
location_t loc = gimple_location (for_stmt);
fd->for_stmt = for_stmt; fd->for_stmt = for_stmt;
fd->pre = NULL; fd->pre = NULL;
@ -309,19 +310,23 @@ extract_omp_for_data (gimple for_stmt, struct omp_for_data *fd,
break; break;
case LE_EXPR: case LE_EXPR:
if (POINTER_TYPE_P (TREE_TYPE (loop->n2))) if (POINTER_TYPE_P (TREE_TYPE (loop->n2)))
loop->n2 = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (loop->n2), loop->n2 = fold_build2_loc (loc,
POINTER_PLUS_EXPR, TREE_TYPE (loop->n2),
loop->n2, size_one_node); loop->n2, size_one_node);
else else
loop->n2 = fold_build2 (PLUS_EXPR, TREE_TYPE (loop->n2), loop->n2, loop->n2 = fold_build2_loc (loc,
PLUS_EXPR, TREE_TYPE (loop->n2), loop->n2,
build_int_cst (TREE_TYPE (loop->n2), 1)); build_int_cst (TREE_TYPE (loop->n2), 1));
loop->cond_code = LT_EXPR; loop->cond_code = LT_EXPR;
break; break;
case GE_EXPR: case GE_EXPR:
if (POINTER_TYPE_P (TREE_TYPE (loop->n2))) if (POINTER_TYPE_P (TREE_TYPE (loop->n2)))
loop->n2 = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (loop->n2), loop->n2 = fold_build2_loc (loc,
POINTER_PLUS_EXPR, TREE_TYPE (loop->n2),
loop->n2, size_int (-1)); loop->n2, size_int (-1));
else else
loop->n2 = fold_build2 (MINUS_EXPR, TREE_TYPE (loop->n2), loop->n2, loop->n2 = fold_build2_loc (loc,
MINUS_EXPR, TREE_TYPE (loop->n2), loop->n2,
build_int_cst (TREE_TYPE (loop->n2), 1)); build_int_cst (TREE_TYPE (loop->n2), 1));
loop->cond_code = GT_EXPR; loop->cond_code = GT_EXPR;
break; break;
@ -339,7 +344,8 @@ extract_omp_for_data (gimple for_stmt, struct omp_for_data *fd,
break; break;
case MINUS_EXPR: case MINUS_EXPR:
loop->step = TREE_OPERAND (t, 1); loop->step = TREE_OPERAND (t, 1);
loop->step = fold_build1 (NEGATE_EXPR, TREE_TYPE (loop->step), loop->step = fold_build1_loc (loc,
NEGATE_EXPR, TREE_TYPE (loop->step),
loop->step); loop->step);
break; break;
default: default:
@ -357,7 +363,8 @@ extract_omp_for_data (gimple for_stmt, struct omp_for_data *fd,
tree n; tree n;
if (loop->cond_code == LT_EXPR) if (loop->cond_code == LT_EXPR)
n = fold_build2 (PLUS_EXPR, TREE_TYPE (loop->v), n = fold_build2_loc (loc,
PLUS_EXPR, TREE_TYPE (loop->v),
loop->n2, loop->step); loop->n2, loop->step);
else else
n = loop->n1; n = loop->n1;
@ -373,12 +380,14 @@ extract_omp_for_data (gimple for_stmt, struct omp_for_data *fd,
if (loop->cond_code == LT_EXPR) if (loop->cond_code == LT_EXPR)
{ {
n1 = loop->n1; n1 = loop->n1;
n2 = fold_build2 (PLUS_EXPR, TREE_TYPE (loop->v), n2 = fold_build2_loc (loc,
PLUS_EXPR, TREE_TYPE (loop->v),
loop->n2, loop->step); loop->n2, loop->step);
} }
else else
{ {
n1 = fold_build2 (MINUS_EXPR, TREE_TYPE (loop->v), n1 = fold_build2_loc (loc,
MINUS_EXPR, TREE_TYPE (loop->v),
loop->n2, loop->step); loop->n2, loop->step);
n2 = loop->n1; n2 = loop->n1;
} }
@ -404,24 +413,26 @@ extract_omp_for_data (gimple for_stmt, struct omp_for_data *fd,
itype itype
= lang_hooks.types.type_for_size (TYPE_PRECISION (itype), 0); = lang_hooks.types.type_for_size (TYPE_PRECISION (itype), 0);
t = build_int_cst (itype, (loop->cond_code == LT_EXPR ? -1 : 1)); t = build_int_cst (itype, (loop->cond_code == LT_EXPR ? -1 : 1));
t = fold_build2 (PLUS_EXPR, itype, t = fold_build2_loc (loc,
fold_convert (itype, loop->step), t); PLUS_EXPR, itype,
t = fold_build2 (PLUS_EXPR, itype, t, fold_convert_loc (loc, itype, loop->step), t);
fold_convert (itype, loop->n2)); t = fold_build2_loc (loc, PLUS_EXPR, itype, t,
t = fold_build2 (MINUS_EXPR, itype, t, fold_convert_loc (loc, itype, loop->n2));
fold_convert (itype, loop->n1)); t = fold_build2_loc (loc, MINUS_EXPR, itype, t,
fold_convert_loc (loc, itype, loop->n1));
if (TYPE_UNSIGNED (itype) && loop->cond_code == GT_EXPR) if (TYPE_UNSIGNED (itype) && loop->cond_code == GT_EXPR)
t = fold_build2 (TRUNC_DIV_EXPR, itype, t = fold_build2_loc (loc, TRUNC_DIV_EXPR, itype,
fold_build1 (NEGATE_EXPR, itype, t), fold_build1_loc (loc, NEGATE_EXPR, itype, t),
fold_build1 (NEGATE_EXPR, itype, fold_build1_loc (loc, NEGATE_EXPR, itype,
fold_convert (itype, fold_convert_loc (loc, itype,
loop->step))); loop->step)));
else else
t = fold_build2 (TRUNC_DIV_EXPR, itype, t, t = fold_build2_loc (loc, TRUNC_DIV_EXPR, itype, t,
fold_convert (itype, loop->step)); fold_convert_loc (loc, itype, loop->step));
t = fold_convert (long_long_unsigned_type_node, t); t = fold_convert_loc (loc, long_long_unsigned_type_node, t);
if (count != NULL_TREE) if (count != NULL_TREE)
count = fold_build2 (MULT_EXPR, long_long_unsigned_type_node, count = fold_build2_loc (loc,
MULT_EXPR, long_long_unsigned_type_node,
count, t); count, t);
else else
count = t; count = t;
@ -448,7 +459,7 @@ extract_omp_for_data (gimple for_stmt, struct omp_for_data *fd,
if (collapse_count && *collapse_count == NULL) if (collapse_count && *collapse_count == NULL)
{ {
if (count) if (count)
*collapse_count = fold_convert (iter_type, count); *collapse_count = fold_convert_loc (loc, iter_type, count);
else else
*collapse_count = create_tmp_var (iter_type, ".count"); *collapse_count = create_tmp_var (iter_type, ".count");
} }
@ -550,6 +561,7 @@ static tree
get_ws_args_for (gimple ws_stmt) get_ws_args_for (gimple ws_stmt)
{ {
tree t; tree t;
location_t loc = gimple_location (ws_stmt);
if (gimple_code (ws_stmt) == GIMPLE_OMP_FOR) if (gimple_code (ws_stmt) == GIMPLE_OMP_FOR)
{ {
@ -561,17 +573,17 @@ get_ws_args_for (gimple ws_stmt)
ws_args = NULL_TREE; ws_args = NULL_TREE;
if (fd.chunk_size) if (fd.chunk_size)
{ {
t = fold_convert (long_integer_type_node, fd.chunk_size); t = fold_convert_loc (loc, long_integer_type_node, fd.chunk_size);
ws_args = tree_cons (NULL, t, ws_args); ws_args = tree_cons (NULL, t, ws_args);
} }
t = fold_convert (long_integer_type_node, fd.loop.step); t = fold_convert_loc (loc, long_integer_type_node, fd.loop.step);
ws_args = tree_cons (NULL, t, ws_args); ws_args = tree_cons (NULL, t, ws_args);
t = fold_convert (long_integer_type_node, fd.loop.n2); t = fold_convert_loc (loc, long_integer_type_node, fd.loop.n2);
ws_args = tree_cons (NULL, t, ws_args); ws_args = tree_cons (NULL, t, ws_args);
t = fold_convert (long_integer_type_node, fd.loop.n1); t = fold_convert_loc (loc, long_integer_type_node, fd.loop.n1);
ws_args = tree_cons (NULL, t, ws_args); ws_args = tree_cons (NULL, t, ws_args);
return ws_args; return ws_args;
@ -1669,6 +1681,7 @@ scan_omp_task (gimple_stmt_iterator *gsi, omp_context *outer_ctx)
omp_context *ctx; omp_context *ctx;
tree name, t; tree name, t;
gimple stmt = gsi_stmt (*gsi); gimple stmt = gsi_stmt (*gsi);
location_t loc = gimple_location (stmt);
/* Ignore task directives with empty bodies. */ /* Ignore task directives with empty bodies. */
if (optimize > 0 if (optimize > 0
@ -1733,7 +1746,7 @@ scan_omp_task (gimple_stmt_iterator *gsi, omp_context *outer_ctx)
fixup_child_record_type (ctx); fixup_child_record_type (ctx);
if (ctx->srecord_type) if (ctx->srecord_type)
layout_type (ctx->srecord_type); layout_type (ctx->srecord_type);
t = fold_convert (long_integer_type_node, t = fold_convert_loc (loc, long_integer_type_node,
TYPE_SIZE_UNIT (ctx->record_type)); TYPE_SIZE_UNIT (ctx->record_type));
gimple_omp_task_set_arg_size (stmt, t); gimple_omp_task_set_arg_size (stmt, t);
t = build_int_cst (long_integer_type_node, t = build_int_cst (long_integer_type_node,
@ -2142,6 +2155,7 @@ maybe_lookup_decl_in_outer_ctx (tree decl, omp_context *ctx)
tree tree
omp_reduction_init (tree clause, tree type) omp_reduction_init (tree clause, tree type)
{ {
location_t loc = OMP_CLAUSE_LOCATION (clause);
switch (OMP_CLAUSE_REDUCTION_CODE (clause)) switch (OMP_CLAUSE_REDUCTION_CODE (clause))
{ {
case PLUS_EXPR: case PLUS_EXPR:
@ -2152,16 +2166,16 @@ omp_reduction_init (tree clause, tree type)
case TRUTH_ORIF_EXPR: case TRUTH_ORIF_EXPR:
case TRUTH_XOR_EXPR: case TRUTH_XOR_EXPR:
case NE_EXPR: case NE_EXPR:
return fold_convert (type, integer_zero_node); return fold_convert_loc (loc, type, integer_zero_node);
case MULT_EXPR: case MULT_EXPR:
case TRUTH_AND_EXPR: case TRUTH_AND_EXPR:
case TRUTH_ANDIF_EXPR: case TRUTH_ANDIF_EXPR:
case EQ_EXPR: case EQ_EXPR:
return fold_convert (type, integer_one_node); return fold_convert_loc (loc, type, integer_one_node);
case BIT_AND_EXPR: case BIT_AND_EXPR:
return fold_convert (type, integer_minus_one_node); return fold_convert_loc (loc, type, integer_minus_one_node);
case MAX_EXPR: case MAX_EXPR:
if (SCALAR_FLOAT_TYPE_P (type)) if (SCALAR_FLOAT_TYPE_P (type))
@ -2233,6 +2247,7 @@ lower_rec_input_clauses (tree clauses, gimple_seq *ilist, gimple_seq *dlist,
enum omp_clause_code c_kind = OMP_CLAUSE_CODE (c); enum omp_clause_code c_kind = OMP_CLAUSE_CODE (c);
tree var, new_var; tree var, new_var;
bool by_ref; bool by_ref;
location_t clause_loc = OMP_CLAUSE_LOCATION (c);
switch (c_kind) switch (c_kind)
{ {
@ -2299,7 +2314,7 @@ lower_rec_input_clauses (tree clauses, gimple_seq *ilist, gimple_seq *dlist,
gimple_seq_add_stmt (ilist, stmt); gimple_seq_add_stmt (ilist, stmt);
x = fold_convert (TREE_TYPE (ptr), tmp); x = fold_convert_loc (clause_loc, TREE_TYPE (ptr), tmp);
gimplify_assign (ptr, x, ilist); gimplify_assign (ptr, x, ilist);
} }
} }
@ -2320,7 +2335,7 @@ lower_rec_input_clauses (tree clauses, gimple_seq *ilist, gimple_seq *dlist,
if (c_kind == OMP_CLAUSE_FIRSTPRIVATE && is_task_ctx (ctx)) if (c_kind == OMP_CLAUSE_FIRSTPRIVATE && is_task_ctx (ctx))
{ {
x = build_receiver_ref (var, false, ctx); x = build_receiver_ref (var, false, ctx);
x = build_fold_addr_expr (x); x = build_fold_addr_expr_loc (clause_loc, x);
} }
else if (TREE_CONSTANT (x)) else if (TREE_CONSTANT (x))
{ {
@ -2332,17 +2347,18 @@ lower_rec_input_clauses (tree clauses, gimple_seq *ilist, gimple_seq *dlist,
name); name);
gimple_add_tmp_var (x); gimple_add_tmp_var (x);
TREE_ADDRESSABLE (x) = 1; TREE_ADDRESSABLE (x) = 1;
x = build_fold_addr_expr (x); x = build_fold_addr_expr_loc (clause_loc, x);
} }
else else
{ {
x = build_call_expr (built_in_decls[BUILT_IN_ALLOCA], 1, x); x = build_call_expr_loc (clause_loc,
built_in_decls[BUILT_IN_ALLOCA], 1, x);
} }
x = fold_convert (TREE_TYPE (new_var), x); x = fold_convert_loc (clause_loc, TREE_TYPE (new_var), x);
gimplify_assign (new_var, x, ilist); gimplify_assign (new_var, x, ilist);
new_var = build_fold_indirect_ref (new_var); new_var = build_fold_indirect_ref_loc (clause_loc, new_var);
} }
else if (c_kind == OMP_CLAUSE_REDUCTION else if (c_kind == OMP_CLAUSE_REDUCTION
&& OMP_CLAUSE_REDUCTION_PLACEHOLDER (c)) && OMP_CLAUSE_REDUCTION_PLACEHOLDER (c))
@ -2446,7 +2462,7 @@ lower_rec_input_clauses (tree clauses, gimple_seq *ilist, gimple_seq *dlist,
x = build_outer_var_ref (var, ctx); x = build_outer_var_ref (var, ctx);
if (is_reference (var)) if (is_reference (var))
x = build_fold_addr_expr (x); x = build_fold_addr_expr_loc (clause_loc, x);
SET_DECL_VALUE_EXPR (placeholder, x); SET_DECL_VALUE_EXPR (placeholder, x);
DECL_HAS_VALUE_EXPR_P (placeholder) = 1; DECL_HAS_VALUE_EXPR_P (placeholder) = 1;
lower_omp (OMP_CLAUSE_REDUCTION_GIMPLE_INIT (c), ctx); lower_omp (OMP_CLAUSE_REDUCTION_GIMPLE_INIT (c), ctx);
@ -2543,6 +2559,7 @@ lower_lastprivate_clauses (tree clauses, tree predicate, gimple_seq *stmt_list,
for (c = clauses; c ;) for (c = clauses; c ;)
{ {
tree var, new_var; tree var, new_var;
location_t clause_loc = OMP_CLAUSE_LOCATION (c);
if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LASTPRIVATE) if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LASTPRIVATE)
{ {
@ -2559,7 +2576,7 @@ lower_lastprivate_clauses (tree clauses, tree predicate, gimple_seq *stmt_list,
x = build_outer_var_ref (var, ctx); x = build_outer_var_ref (var, ctx);
if (is_reference (var)) if (is_reference (var))
new_var = build_fold_indirect_ref (new_var); new_var = build_fold_indirect_ref_loc (clause_loc, new_var);
x = lang_hooks.decls.omp_clause_assign_op (c, x, new_var); x = lang_hooks.decls.omp_clause_assign_op (c, x, new_var);
gimplify_and_add (x, stmt_list); gimplify_and_add (x, stmt_list);
} }
@ -2618,6 +2635,7 @@ lower_reduction_clauses (tree clauses, gimple_seq *stmt_seqp, omp_context *ctx)
{ {
tree var, ref, new_var; tree var, ref, new_var;
enum tree_code code; enum tree_code code;
location_t clause_loc = OMP_CLAUSE_LOCATION (c);
if (OMP_CLAUSE_CODE (c) != OMP_CLAUSE_REDUCTION) if (OMP_CLAUSE_CODE (c) != OMP_CLAUSE_REDUCTION)
continue; continue;
@ -2625,7 +2643,7 @@ lower_reduction_clauses (tree clauses, gimple_seq *stmt_seqp, omp_context *ctx)
var = OMP_CLAUSE_DECL (c); var = OMP_CLAUSE_DECL (c);
new_var = lookup_decl (var, ctx); new_var = lookup_decl (var, ctx);
if (is_reference (var)) if (is_reference (var))
new_var = build_fold_indirect_ref (new_var); new_var = build_fold_indirect_ref_loc (clause_loc, new_var);
ref = build_outer_var_ref (var, ctx); ref = build_outer_var_ref (var, ctx);
code = OMP_CLAUSE_REDUCTION_CODE (c); code = OMP_CLAUSE_REDUCTION_CODE (c);
@ -2636,11 +2654,11 @@ lower_reduction_clauses (tree clauses, gimple_seq *stmt_seqp, omp_context *ctx)
if (count == 1) if (count == 1)
{ {
tree addr = build_fold_addr_expr (ref); tree addr = build_fold_addr_expr_loc (clause_loc, ref);
addr = save_expr (addr); addr = save_expr (addr);
ref = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (addr)), addr); ref = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (addr)), addr);
x = fold_build2 (code, TREE_TYPE (ref), ref, new_var); x = fold_build2_loc (clause_loc, code, TREE_TYPE (ref), ref, new_var);
x = build2 (OMP_ATOMIC, void_type_node, addr, x); x = build2 (OMP_ATOMIC, void_type_node, addr, x);
gimplify_and_add (x, stmt_seqp); gimplify_and_add (x, stmt_seqp);
return; return;
@ -2651,7 +2669,7 @@ lower_reduction_clauses (tree clauses, gimple_seq *stmt_seqp, omp_context *ctx)
tree placeholder = OMP_CLAUSE_REDUCTION_PLACEHOLDER (c); tree placeholder = OMP_CLAUSE_REDUCTION_PLACEHOLDER (c);
if (is_reference (var)) if (is_reference (var))
ref = build_fold_addr_expr (ref); ref = build_fold_addr_expr_loc (clause_loc, ref);
SET_DECL_VALUE_EXPR (placeholder, ref); SET_DECL_VALUE_EXPR (placeholder, ref);
DECL_HAS_VALUE_EXPR_P (placeholder) = 1; DECL_HAS_VALUE_EXPR_P (placeholder) = 1;
lower_omp (OMP_CLAUSE_REDUCTION_GIMPLE_MERGE (c), ctx); lower_omp (OMP_CLAUSE_REDUCTION_GIMPLE_MERGE (c), ctx);
@ -2689,6 +2707,7 @@ lower_copyprivate_clauses (tree clauses, gimple_seq *slist, gimple_seq *rlist,
{ {
tree var, ref, x; tree var, ref, x;
bool by_ref; bool by_ref;
location_t clause_loc = OMP_CLAUSE_LOCATION (c);
if (OMP_CLAUSE_CODE (c) != OMP_CLAUSE_COPYPRIVATE) if (OMP_CLAUSE_CODE (c) != OMP_CLAUSE_COPYPRIVATE)
continue; continue;
@ -2698,14 +2717,14 @@ lower_copyprivate_clauses (tree clauses, gimple_seq *slist, gimple_seq *rlist,
ref = build_sender_ref (var, ctx); ref = build_sender_ref (var, ctx);
x = lookup_decl_in_outer_ctx (var, ctx); x = lookup_decl_in_outer_ctx (var, ctx);
x = by_ref ? build_fold_addr_expr (x) : x; x = by_ref ? build_fold_addr_expr_loc (clause_loc, x) : x;
gimplify_assign (ref, x, slist); gimplify_assign (ref, x, slist);
ref = build_receiver_ref (var, by_ref, ctx); ref = build_receiver_ref (var, by_ref, ctx);
if (is_reference (var)) if (is_reference (var))
{ {
ref = build_fold_indirect_ref (ref); ref = build_fold_indirect_ref_loc (clause_loc, ref);
var = build_fold_indirect_ref (var); var = build_fold_indirect_ref_loc (clause_loc, var);
} }
x = lang_hooks.decls.omp_clause_assign_op (c, var, ref); x = lang_hooks.decls.omp_clause_assign_op (c, var, ref);
gimplify_and_add (x, rlist); gimplify_and_add (x, rlist);
@ -2726,6 +2745,7 @@ lower_send_clauses (tree clauses, gimple_seq *ilist, gimple_seq *olist,
{ {
tree val, ref, x, var; tree val, ref, x, var;
bool by_ref, do_in = false, do_out = false; bool by_ref, do_in = false, do_out = false;
location_t clause_loc = OMP_CLAUSE_LOCATION (c);
switch (OMP_CLAUSE_CODE (c)) switch (OMP_CLAUSE_CODE (c))
{ {
@ -2787,7 +2807,7 @@ lower_send_clauses (tree clauses, gimple_seq *ilist, gimple_seq *olist,
if (do_in) if (do_in)
{ {
ref = build_sender_ref (val, ctx); ref = build_sender_ref (val, ctx);
x = by_ref ? build_fold_addr_expr (var) : var; x = by_ref ? build_fold_addr_expr_loc (clause_loc, var) : var;
gimplify_assign (ref, x, ilist); gimplify_assign (ref, x, ilist);
if (is_task_ctx (ctx)) if (is_task_ctx (ctx))
DECL_ABSTRACT_ORIGIN (TREE_OPERAND (ref, 1)) = NULL; DECL_ABSTRACT_ORIGIN (TREE_OPERAND (ref, 1)) = NULL;
@ -2883,6 +2903,7 @@ expand_parallel_call (struct omp_region *region, basic_block bb,
gimple_stmt_iterator gsi; gimple_stmt_iterator gsi;
gimple stmt; gimple stmt;
int start_ix; int start_ix;
location_t clause_loc;
clauses = gimple_omp_parallel_clauses (entry_stmt); clauses = gimple_omp_parallel_clauses (entry_stmt);
@ -2919,10 +2940,15 @@ expand_parallel_call (struct omp_region *region, basic_block bb,
c = find_omp_clause (clauses, OMP_CLAUSE_NUM_THREADS); c = find_omp_clause (clauses, OMP_CLAUSE_NUM_THREADS);
if (c) if (c)
val = OMP_CLAUSE_NUM_THREADS_EXPR (c); {
val = OMP_CLAUSE_NUM_THREADS_EXPR (c);
clause_loc = OMP_CLAUSE_LOCATION (c);
}
else
clause_loc = gimple_location (entry_stmt);
/* Ensure 'val' is of the correct type. */ /* Ensure 'val' is of the correct type. */
val = fold_convert (unsigned_type_node, val); val = fold_convert_loc (clause_loc, unsigned_type_node, val);
/* If we found the clause 'if (cond)', build either /* If we found the clause 'if (cond)', build either
(cond != 0) or (cond ? val : 1u). */ (cond != 0) or (cond ? val : 1u). */
@ -2933,7 +2959,8 @@ expand_parallel_call (struct omp_region *region, basic_block bb,
cond = gimple_boolify (cond); cond = gimple_boolify (cond);
if (integer_zerop (val)) if (integer_zerop (val))
val = fold_build2 (EQ_EXPR, unsigned_type_node, cond, val = fold_build2_loc (clause_loc,
EQ_EXPR, unsigned_type_node, cond,
build_int_cst (TREE_TYPE (cond), 0)); build_int_cst (TREE_TYPE (cond), 0));
else else
{ {
@ -3012,7 +3039,8 @@ expand_parallel_call (struct omp_region *region, basic_block bb,
tree args = tree_cons (NULL, t2, tree args = tree_cons (NULL, t2,
tree_cons (NULL, t1, tree_cons (NULL, t1,
tree_cons (NULL, val, ws_args))); tree_cons (NULL, val, ws_args)));
t = build_function_call_expr (built_in_decls[start_ix], args); t = build_function_call_expr (UNKNOWN_LOCATION,
built_in_decls[start_ix], args);
} }
else else
t = build_call_expr (built_in_decls[start_ix], 3, t2, t1, val); t = build_call_expr (built_in_decls[start_ix], 3, t2, t1, val);
@ -3025,11 +3053,13 @@ expand_parallel_call (struct omp_region *region, basic_block bb,
t = null_pointer_node; t = null_pointer_node;
else else
t = build_fold_addr_expr (t); t = build_fold_addr_expr (t);
t = build_call_expr (gimple_omp_parallel_child_fn (entry_stmt), 1, t); t = build_call_expr_loc (gimple_location (entry_stmt),
gimple_omp_parallel_child_fn (entry_stmt), 1, t);
force_gimple_operand_gsi (&gsi, t, true, NULL_TREE, force_gimple_operand_gsi (&gsi, t, true, NULL_TREE,
false, GSI_CONTINUE_LINKING); false, GSI_CONTINUE_LINKING);
t = build_call_expr (built_in_decls[BUILT_IN_GOMP_PARALLEL_END], 0); t = build_call_expr_loc (gimple_location (entry_stmt),
built_in_decls[BUILT_IN_GOMP_PARALLEL_END], 0);
force_gimple_operand_gsi (&gsi, t, true, NULL_TREE, force_gimple_operand_gsi (&gsi, t, true, NULL_TREE,
false, GSI_CONTINUE_LINKING); false, GSI_CONTINUE_LINKING);
} }
@ -3043,6 +3073,7 @@ expand_task_call (basic_block bb, gimple entry_stmt)
{ {
tree t, t1, t2, t3, flags, cond, c, clauses; tree t, t1, t2, t3, flags, cond, c, clauses;
gimple_stmt_iterator gsi; gimple_stmt_iterator gsi;
location_t loc = gimple_location (entry_stmt);
clauses = gimple_omp_task_clauses (entry_stmt); clauses = gimple_omp_task_clauses (entry_stmt);
@ -3060,13 +3091,13 @@ expand_task_call (basic_block bb, gimple entry_stmt)
if (t == NULL) if (t == NULL)
t2 = null_pointer_node; t2 = null_pointer_node;
else else
t2 = build_fold_addr_expr (t); t2 = build_fold_addr_expr_loc (loc, t);
t1 = build_fold_addr_expr (gimple_omp_task_child_fn (entry_stmt)); t1 = build_fold_addr_expr_loc (loc, gimple_omp_task_child_fn (entry_stmt));
t = gimple_omp_task_copy_fn (entry_stmt); t = gimple_omp_task_copy_fn (entry_stmt);
if (t == NULL) if (t == NULL)
t3 = null_pointer_node; t3 = null_pointer_node;
else else
t3 = build_fold_addr_expr (t); t3 = build_fold_addr_expr_loc (loc, t);
t = build_call_expr (built_in_decls[BUILT_IN_GOMP_TASK], 7, t1, t2, t3, t = build_call_expr (built_in_decls[BUILT_IN_GOMP_TASK], 7, t1, t2, t3,
gimple_omp_task_arg_size (entry_stmt), gimple_omp_task_arg_size (entry_stmt),
@ -4887,6 +4918,7 @@ expand_omp_atomic_fetch_op (basic_block load_bb,
basic_block store_bb = single_succ (load_bb); basic_block store_bb = single_succ (load_bb);
gimple_stmt_iterator gsi; gimple_stmt_iterator gsi;
gimple stmt; gimple stmt;
location_t loc;
/* We expect to find the following sequences: /* We expect to find the following sequences:
@ -4904,6 +4936,7 @@ expand_omp_atomic_fetch_op (basic_block load_bb,
gsi = gsi_after_labels (store_bb); gsi = gsi_after_labels (store_bb);
stmt = gsi_stmt (gsi); stmt = gsi_stmt (gsi);
loc = gimple_location (stmt);
if (!is_gimple_assign (stmt)) if (!is_gimple_assign (stmt))
return false; return false;
gsi_next (&gsi); gsi_next (&gsi);
@ -4957,8 +4990,10 @@ expand_omp_atomic_fetch_op (basic_block load_bb,
gsi = gsi_last_bb (load_bb); gsi = gsi_last_bb (load_bb);
gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_ATOMIC_LOAD); gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_ATOMIC_LOAD);
call = build_call_expr (decl, 2, addr, fold_convert (itype, rhs)); call = build_call_expr_loc (loc,
call = fold_convert (void_type_node, call); decl, 2, addr,
fold_convert_loc (loc, itype, rhs));
call = fold_convert_loc (loc, void_type_node, call);
force_gimple_operand_gsi (&gsi, call, true, NULL_TREE, true, GSI_SAME_STMT); force_gimple_operand_gsi (&gsi, call, true, NULL_TREE, true, GSI_SAME_STMT);
gsi_remove (&gsi, true); gsi_remove (&gsi, true);
@ -5180,7 +5215,7 @@ expand_omp_atomic_mutex (basic_block load_bb, basic_block store_bb,
gcc_assert (gimple_code (gsi_stmt (si)) == GIMPLE_OMP_ATOMIC_LOAD); gcc_assert (gimple_code (gsi_stmt (si)) == GIMPLE_OMP_ATOMIC_LOAD);
t = built_in_decls[BUILT_IN_GOMP_ATOMIC_START]; t = built_in_decls[BUILT_IN_GOMP_ATOMIC_START];
t = build_function_call_expr (t, 0); t = build_function_call_expr (UNKNOWN_LOCATION, t, 0);
force_gimple_operand_gsi (&si, t, true, NULL_TREE, true, GSI_SAME_STMT); force_gimple_operand_gsi (&si, t, true, NULL_TREE, true, GSI_SAME_STMT);
stmt = gimple_build_assign (loaded_val, build_fold_indirect_ref (addr)); stmt = gimple_build_assign (loaded_val, build_fold_indirect_ref (addr));
@ -5195,7 +5230,7 @@ expand_omp_atomic_mutex (basic_block load_bb, basic_block store_bb,
gsi_insert_before (&si, stmt, GSI_SAME_STMT); gsi_insert_before (&si, stmt, GSI_SAME_STMT);
t = built_in_decls[BUILT_IN_GOMP_ATOMIC_END]; t = built_in_decls[BUILT_IN_GOMP_ATOMIC_END];
t = build_function_call_expr (t, 0); t = build_function_call_expr (UNKNOWN_LOCATION, t, 0);
force_gimple_operand_gsi (&si, t, true, NULL_TREE, true, GSI_SAME_STMT); force_gimple_operand_gsi (&si, t, true, NULL_TREE, true, GSI_SAME_STMT);
gsi_remove (&si, true); gsi_remove (&si, true);
@ -5618,7 +5653,8 @@ lower_omp_single_simple (gimple single_stmt, gimple_seq *pre_p)
gimple_seq_add_stmt (pre_p, call); gimple_seq_add_stmt (pre_p, call);
cond = gimple_build_cond (EQ_EXPR, lhs, cond = gimple_build_cond (EQ_EXPR, lhs,
fold_convert (TREE_TYPE (lhs), boolean_true_node), fold_convert_loc (loc, TREE_TYPE (lhs),
boolean_true_node),
tlabel, flabel); tlabel, flabel);
gimple_seq_add_stmt (pre_p, cond); gimple_seq_add_stmt (pre_p, cond);
gimple_seq_add_stmt (pre_p, gimple_build_label (tlabel)); gimple_seq_add_stmt (pre_p, gimple_build_label (tlabel));
@ -5672,8 +5708,8 @@ lower_omp_single_copy (gimple single_stmt, gimple_seq *pre_p, omp_context *ctx)
l1 = create_artificial_label (loc); l1 = create_artificial_label (loc);
l2 = create_artificial_label (loc); l2 = create_artificial_label (loc);
t = build_call_expr (built_in_decls[BUILT_IN_GOMP_SINGLE_COPY_START], 0); t = build_call_expr_loc (loc, built_in_decls[BUILT_IN_GOMP_SINGLE_COPY_START], 0);
t = fold_convert (ptr_type, t); t = fold_convert_loc (loc, ptr_type, t);
gimplify_assign (ctx->receiver_decl, t, pre_p); gimplify_assign (ctx->receiver_decl, t, pre_p);
t = build2 (EQ_EXPR, boolean_type_node, ctx->receiver_decl, t = build2 (EQ_EXPR, boolean_type_node, ctx->receiver_decl,
@ -5690,8 +5726,9 @@ lower_omp_single_copy (gimple single_stmt, gimple_seq *pre_p, omp_context *ctx)
lower_copyprivate_clauses (gimple_omp_single_clauses (single_stmt), pre_p, lower_copyprivate_clauses (gimple_omp_single_clauses (single_stmt), pre_p,
&copyin_seq, ctx); &copyin_seq, ctx);
t = build_fold_addr_expr (ctx->sender_decl); t = build_fold_addr_expr_loc (loc, ctx->sender_decl);
t = build_call_expr (built_in_decls[BUILT_IN_GOMP_SINGLE_COPY_END], 1, t); t = build_call_expr_loc (loc, built_in_decls[BUILT_IN_GOMP_SINGLE_COPY_END],
1, t);
gimplify_and_add (t, pre_p); gimplify_and_add (t, pre_p);
t = build_and_jump (&l2); t = build_and_jump (&l2);
@ -5760,6 +5797,7 @@ lower_omp_master (gimple_stmt_iterator *gsi_p, omp_context *ctx)
{ {
tree block, lab = NULL, x; tree block, lab = NULL, x;
gimple stmt = gsi_stmt (*gsi_p), bind; gimple stmt = gsi_stmt (*gsi_p), bind;
location_t loc = gimple_location (stmt);
gimple_seq tseq; gimple_seq tseq;
struct gimplify_ctx gctx; struct gimplify_ctx gctx;
@ -5769,7 +5807,7 @@ lower_omp_master (gimple_stmt_iterator *gsi_p, omp_context *ctx)
bind = gimple_build_bind (NULL, gimple_seq_alloc_with_stmt (stmt), bind = gimple_build_bind (NULL, gimple_seq_alloc_with_stmt (stmt),
block); block);
x = build_call_expr (built_in_decls[BUILT_IN_OMP_GET_THREAD_NUM], 0); x = build_call_expr_loc (loc, built_in_decls[BUILT_IN_OMP_GET_THREAD_NUM], 0);
x = build2 (EQ_EXPR, boolean_type_node, x, integer_zero_node); x = build2 (EQ_EXPR, boolean_type_node, x, integer_zero_node);
x = build3 (COND_EXPR, void_type_node, x, NULL, build_and_jump (&lab)); x = build3 (COND_EXPR, void_type_node, x, NULL, build_and_jump (&lab));
tseq = NULL; tseq = NULL;
@ -5843,6 +5881,7 @@ lower_omp_critical (gimple_stmt_iterator *gsi_p, omp_context *ctx)
tree block; tree block;
tree name, lock, unlock; tree name, lock, unlock;
gimple stmt = gsi_stmt (*gsi_p), bind; gimple stmt = gsi_stmt (*gsi_p), bind;
location_t loc = gimple_location (stmt);
gimple_seq tbody; gimple_seq tbody;
struct gimplify_ctx gctx; struct gimplify_ctx gctx;
@ -5880,18 +5919,19 @@ lower_omp_critical (gimple_stmt_iterator *gsi_p, omp_context *ctx)
decl = (tree) n->value; decl = (tree) n->value;
lock = built_in_decls[BUILT_IN_GOMP_CRITICAL_NAME_START]; lock = built_in_decls[BUILT_IN_GOMP_CRITICAL_NAME_START];
lock = build_call_expr (lock, 1, build_fold_addr_expr (decl)); lock = build_call_expr_loc (loc, lock, 1, build_fold_addr_expr_loc (loc, decl));
unlock = built_in_decls[BUILT_IN_GOMP_CRITICAL_NAME_END]; unlock = built_in_decls[BUILT_IN_GOMP_CRITICAL_NAME_END];
unlock = build_call_expr (unlock, 1, build_fold_addr_expr (decl)); unlock = build_call_expr_loc (loc, unlock, 1,
build_fold_addr_expr_loc (loc, decl));
} }
else else
{ {
lock = built_in_decls[BUILT_IN_GOMP_CRITICAL_START]; lock = built_in_decls[BUILT_IN_GOMP_CRITICAL_START];
lock = build_call_expr (lock, 0); lock = build_call_expr_loc (loc, lock, 0);
unlock = built_in_decls[BUILT_IN_GOMP_CRITICAL_END]; unlock = built_in_decls[BUILT_IN_GOMP_CRITICAL_END];
unlock = build_call_expr (unlock, 0); unlock = build_call_expr_loc (loc, unlock, 0);
} }
push_gimplify_context (&gctx); push_gimplify_context (&gctx);
@ -6152,6 +6192,7 @@ create_task_copyfn (gimple task_stmt, omp_context *ctx)
splay_tree_node n; splay_tree_node n;
struct omp_taskcopy_context tcctx; struct omp_taskcopy_context tcctx;
struct gimplify_ctx gctx; struct gimplify_ctx gctx;
location_t loc = gimple_location (task_stmt);
child_fn = gimple_omp_task_copy_fn (task_stmt); child_fn = gimple_omp_task_copy_fn (task_stmt);
child_cfun = DECL_STRUCT_FUNCTION (child_fn); child_cfun = DECL_STRUCT_FUNCTION (child_fn);
@ -6233,7 +6274,7 @@ create_task_copyfn (gimple task_stmt, omp_context *ctx)
n = splay_tree_lookup (ctx->sfield_map, (splay_tree_key) decl); n = splay_tree_lookup (ctx->sfield_map, (splay_tree_key) decl);
sf = (tree) n->value; sf = (tree) n->value;
sf = *(tree *) pointer_map_contains (tcctx.cb.decl_map, sf); sf = *(tree *) pointer_map_contains (tcctx.cb.decl_map, sf);
src = build_fold_indirect_ref (sarg); src = build_fold_indirect_ref_loc (loc, sarg);
src = build3 (COMPONENT_REF, TREE_TYPE (sf), src, sf, NULL); src = build3 (COMPONENT_REF, TREE_TYPE (sf), src, sf, NULL);
t = build2 (MODIFY_EXPR, TREE_TYPE (*p), *p, src); t = build2 (MODIFY_EXPR, TREE_TYPE (*p), *p, src);
append_to_statement_list (t, &list); append_to_statement_list (t, &list);
@ -6256,9 +6297,9 @@ create_task_copyfn (gimple task_stmt, omp_context *ctx)
sf = (tree) n->value; sf = (tree) n->value;
if (tcctx.cb.decl_map) if (tcctx.cb.decl_map)
sf = *(tree *) pointer_map_contains (tcctx.cb.decl_map, sf); sf = *(tree *) pointer_map_contains (tcctx.cb.decl_map, sf);
src = build_fold_indirect_ref (sarg); src = build_fold_indirect_ref_loc (loc, sarg);
src = build3 (COMPONENT_REF, TREE_TYPE (sf), src, sf, NULL); src = build3 (COMPONENT_REF, TREE_TYPE (sf), src, sf, NULL);
dst = build_fold_indirect_ref (arg); dst = build_fold_indirect_ref_loc (loc, arg);
dst = build3 (COMPONENT_REF, TREE_TYPE (f), dst, f, NULL); dst = build3 (COMPONENT_REF, TREE_TYPE (f), dst, f, NULL);
t = build2 (MODIFY_EXPR, TREE_TYPE (dst), dst, src); t = build2 (MODIFY_EXPR, TREE_TYPE (dst), dst, src);
append_to_statement_list (t, &list); append_to_statement_list (t, &list);
@ -6279,14 +6320,14 @@ create_task_copyfn (gimple task_stmt, omp_context *ctx)
sf = (tree) n->value; sf = (tree) n->value;
if (tcctx.cb.decl_map) if (tcctx.cb.decl_map)
sf = *(tree *) pointer_map_contains (tcctx.cb.decl_map, sf); sf = *(tree *) pointer_map_contains (tcctx.cb.decl_map, sf);
src = build_fold_indirect_ref (sarg); src = build_fold_indirect_ref_loc (loc, sarg);
src = build3 (COMPONENT_REF, TREE_TYPE (sf), src, sf, NULL); src = build3 (COMPONENT_REF, TREE_TYPE (sf), src, sf, NULL);
if (use_pointer_for_field (decl, NULL) || is_reference (decl)) if (use_pointer_for_field (decl, NULL) || is_reference (decl))
src = build_fold_indirect_ref (src); src = build_fold_indirect_ref_loc (loc, src);
} }
else else
src = decl; src = decl;
dst = build_fold_indirect_ref (arg); dst = build_fold_indirect_ref_loc (loc, arg);
dst = build3 (COMPONENT_REF, TREE_TYPE (f), dst, f, NULL); dst = build3 (COMPONENT_REF, TREE_TYPE (f), dst, f, NULL);
t = lang_hooks.decls.omp_clause_copy_ctor (c, dst, src); t = lang_hooks.decls.omp_clause_copy_ctor (c, dst, src);
append_to_statement_list (t, &list); append_to_statement_list (t, &list);
@ -6305,14 +6346,14 @@ create_task_copyfn (gimple task_stmt, omp_context *ctx)
sf = (tree) n->value; sf = (tree) n->value;
if (tcctx.cb.decl_map) if (tcctx.cb.decl_map)
sf = *(tree *) pointer_map_contains (tcctx.cb.decl_map, sf); sf = *(tree *) pointer_map_contains (tcctx.cb.decl_map, sf);
src = build_fold_indirect_ref (sarg); src = build_fold_indirect_ref_loc (loc, sarg);
src = build3 (COMPONENT_REF, TREE_TYPE (sf), src, sf, NULL); src = build3 (COMPONENT_REF, TREE_TYPE (sf), src, sf, NULL);
if (use_pointer_for_field (decl, NULL)) if (use_pointer_for_field (decl, NULL))
src = build_fold_indirect_ref (src); src = build_fold_indirect_ref_loc (loc, src);
} }
else else
src = decl; src = decl;
dst = build_fold_indirect_ref (arg); dst = build_fold_indirect_ref_loc (loc, arg);
dst = build3 (COMPONENT_REF, TREE_TYPE (f), dst, f, NULL); dst = build3 (COMPONENT_REF, TREE_TYPE (f), dst, f, NULL);
t = build2 (MODIFY_EXPR, TREE_TYPE (dst), dst, src); t = build2 (MODIFY_EXPR, TREE_TYPE (dst), dst, src);
append_to_statement_list (t, &list); append_to_statement_list (t, &list);
@ -6344,10 +6385,10 @@ create_task_copyfn (gimple task_stmt, omp_context *ctx)
(splay_tree_key) TREE_OPERAND (ind, 0)); (splay_tree_key) TREE_OPERAND (ind, 0));
sf = (tree) n->value; sf = (tree) n->value;
sf = *(tree *) pointer_map_contains (tcctx.cb.decl_map, sf); sf = *(tree *) pointer_map_contains (tcctx.cb.decl_map, sf);
src = build_fold_indirect_ref (sarg); src = build_fold_indirect_ref_loc (loc, sarg);
src = build3 (COMPONENT_REF, TREE_TYPE (sf), src, sf, NULL); src = build3 (COMPONENT_REF, TREE_TYPE (sf), src, sf, NULL);
src = build_fold_indirect_ref (src); src = build_fold_indirect_ref_loc (loc, src);
dst = build_fold_indirect_ref (arg); dst = build_fold_indirect_ref_loc (loc, arg);
dst = build3 (COMPONENT_REF, TREE_TYPE (f), dst, f, NULL); dst = build3 (COMPONENT_REF, TREE_TYPE (f), dst, f, NULL);
t = lang_hooks.decls.omp_clause_copy_ctor (c, dst, src); t = lang_hooks.decls.omp_clause_copy_ctor (c, dst, src);
append_to_statement_list (t, &list); append_to_statement_list (t, &list);
@ -6355,10 +6396,10 @@ create_task_copyfn (gimple task_stmt, omp_context *ctx)
(splay_tree_key) TREE_OPERAND (ind, 0)); (splay_tree_key) TREE_OPERAND (ind, 0));
df = (tree) n->value; df = (tree) n->value;
df = *(tree *) pointer_map_contains (tcctx.cb.decl_map, df); df = *(tree *) pointer_map_contains (tcctx.cb.decl_map, df);
ptr = build_fold_indirect_ref (arg); ptr = build_fold_indirect_ref_loc (loc, arg);
ptr = build3 (COMPONENT_REF, TREE_TYPE (df), ptr, df, NULL); ptr = build3 (COMPONENT_REF, TREE_TYPE (df), ptr, df, NULL);
t = build2 (MODIFY_EXPR, TREE_TYPE (ptr), ptr, t = build2 (MODIFY_EXPR, TREE_TYPE (ptr), ptr,
build_fold_addr_expr (dst)); build_fold_addr_expr_loc (loc, dst));
append_to_statement_list (t, &list); append_to_statement_list (t, &list);
} }
@ -6385,6 +6426,7 @@ lower_omp_taskreg (gimple_stmt_iterator *gsi_p, omp_context *ctx)
gimple par_bind, bind; gimple par_bind, bind;
gimple_seq par_body, olist, ilist, par_olist, par_ilist, new_body; gimple_seq par_body, olist, ilist, par_olist, par_ilist, new_body;
struct gimplify_ctx gctx; struct gimplify_ctx gctx;
location_t loc = gimple_location (stmt);
clauses = gimple_omp_taskreg_clauses (stmt); clauses = gimple_omp_taskreg_clauses (stmt);
par_bind = gimple_seq_first_stmt (gimple_omp_body (stmt)); par_bind = gimple_seq_first_stmt (gimple_omp_body (stmt));
@ -6441,9 +6483,9 @@ lower_omp_taskreg (gimple_stmt_iterator *gsi_p, omp_context *ctx)
if (ctx->record_type) if (ctx->record_type)
{ {
t = build_fold_addr_expr (ctx->sender_decl); t = build_fold_addr_expr_loc (loc, ctx->sender_decl);
/* fixup_child_record_type might have changed receiver_decl's type. */ /* fixup_child_record_type might have changed receiver_decl's type. */
t = fold_convert (TREE_TYPE (ctx->receiver_decl), t); t = fold_convert_loc (loc, TREE_TYPE (ctx->receiver_decl), t);
gimple_seq_add_stmt (&new_body, gimple_seq_add_stmt (&new_body,
gimple_build_assign (ctx->receiver_decl, t)); gimple_build_assign (ctx->receiver_decl, t));
} }

View File

@ -342,7 +342,7 @@ self_referential_size (tree size)
VEC_safe_push (tree, gc, size_functions, fndecl); VEC_safe_push (tree, gc, size_functions, fndecl);
/* Replace the original expression with a call to the size function. */ /* Replace the original expression with a call to the size function. */
return build_function_call_expr (fndecl, arg_list); return build_function_call_expr (input_location, fndecl, arg_list);
} }
/* Take, queue and compile all the size functions. It is essential that /* Take, queue and compile all the size functions. It is essential that
@ -515,6 +515,7 @@ layout_decl (tree decl, unsigned int known_align)
tree type = TREE_TYPE (decl); tree type = TREE_TYPE (decl);
enum tree_code code = TREE_CODE (decl); enum tree_code code = TREE_CODE (decl);
rtx rtl = NULL_RTX; rtx rtl = NULL_RTX;
location_t loc = DECL_SOURCE_LOCATION (decl);
if (code == CONST_DECL) if (code == CONST_DECL)
return; return;
@ -548,8 +549,9 @@ layout_decl (tree decl, unsigned int known_align)
} }
else if (DECL_SIZE_UNIT (decl) == 0) else if (DECL_SIZE_UNIT (decl) == 0)
DECL_SIZE_UNIT (decl) DECL_SIZE_UNIT (decl)
= fold_convert (sizetype, size_binop (CEIL_DIV_EXPR, DECL_SIZE (decl), = fold_convert_loc (loc, sizetype,
bitsize_unit_node)); size_binop_loc (loc, CEIL_DIV_EXPR, DECL_SIZE (decl),
bitsize_unit_node));
if (code != FIELD_DECL) if (code != FIELD_DECL)
/* For non-fields, update the alignment from the type. */ /* For non-fields, update the alignment from the type. */
@ -994,7 +996,7 @@ place_union_field (record_layout_info rli, tree field)
if (TREE_CODE (rli->t) == UNION_TYPE) if (TREE_CODE (rli->t) == UNION_TYPE)
rli->offset = size_binop (MAX_EXPR, rli->offset, DECL_SIZE_UNIT (field)); rli->offset = size_binop (MAX_EXPR, rli->offset, DECL_SIZE_UNIT (field));
else if (TREE_CODE (rli->t) == QUAL_UNION_TYPE) else if (TREE_CODE (rli->t) == QUAL_UNION_TYPE)
rli->offset = fold_build3 (COND_EXPR, sizetype, rli->offset = fold_build3_loc (input_location, COND_EXPR, sizetype,
DECL_QUALIFIER (field), DECL_QUALIFIER (field),
DECL_SIZE_UNIT (field), rli->offset); DECL_SIZE_UNIT (field), rli->offset);
} }
@ -1181,7 +1183,7 @@ place_field (record_layout_info rli, tree field)
field); field);
} }
else else
rli->bitpos = round_up (rli->bitpos, type_align); rli->bitpos = round_up_loc (input_location, rli->bitpos, type_align);
} }
if (! DECL_PACKED (field)) if (! DECL_PACKED (field))
@ -1361,7 +1363,7 @@ place_field (record_layout_info rli, tree field)
if (maximum_field_alignment != 0) if (maximum_field_alignment != 0)
type_align = MIN (type_align, maximum_field_alignment); type_align = MIN (type_align, maximum_field_alignment);
rli->bitpos = round_up (rli->bitpos, type_align); rli->bitpos = round_up_loc (input_location, rli->bitpos, type_align);
/* If we really aligned, don't allow subsequent bitfields /* If we really aligned, don't allow subsequent bitfields
to undo that. */ to undo that. */
@ -1475,9 +1477,10 @@ finalize_record_size (record_layout_info rli)
= size_binop (PLUS_EXPR, unpadded_size_unit, size_one_node); = size_binop (PLUS_EXPR, unpadded_size_unit, size_one_node);
/* Round the size up to be a multiple of the required alignment. */ /* Round the size up to be a multiple of the required alignment. */
TYPE_SIZE (rli->t) = round_up (unpadded_size, TYPE_ALIGN (rli->t)); TYPE_SIZE (rli->t) = round_up_loc (input_location, unpadded_size,
TYPE_ALIGN (rli->t));
TYPE_SIZE_UNIT (rli->t) TYPE_SIZE_UNIT (rli->t)
= round_up (unpadded_size_unit, TYPE_ALIGN_UNIT (rli->t)); = round_up_loc (input_location, unpadded_size_unit, TYPE_ALIGN_UNIT (rli->t));
if (TREE_CONSTANT (unpadded_size) if (TREE_CONSTANT (unpadded_size)
&& simple_cst_equal (unpadded_size, TYPE_SIZE (rli->t)) == 0) && simple_cst_equal (unpadded_size, TYPE_SIZE (rli->t)) == 0)
@ -1496,7 +1499,7 @@ finalize_record_size (record_layout_info rli)
rli->unpacked_align = MAX (TYPE_ALIGN (rli->t), rli->unpacked_align); rli->unpacked_align = MAX (TYPE_ALIGN (rli->t), rli->unpacked_align);
#endif #endif
unpacked_size = round_up (TYPE_SIZE (rli->t), rli->unpacked_align); unpacked_size = round_up_loc (input_location, TYPE_SIZE (rli->t), rli->unpacked_align);
if (simple_cst_equal (unpacked_size, TYPE_SIZE (rli->t))) if (simple_cst_equal (unpacked_size, TYPE_SIZE (rli->t)))
{ {
TYPE_PACKED (rli->t) = 0; TYPE_PACKED (rli->t) = 0;
@ -1650,8 +1653,9 @@ finalize_type_size (tree type)
if (TYPE_SIZE (type) != 0) if (TYPE_SIZE (type) != 0)
{ {
TYPE_SIZE (type) = round_up (TYPE_SIZE (type), TYPE_ALIGN (type)); TYPE_SIZE (type) = round_up_loc (input_location,
TYPE_SIZE_UNIT (type) = round_up (TYPE_SIZE_UNIT (type), TYPE_SIZE (type), TYPE_ALIGN (type));
TYPE_SIZE_UNIT (type) = round_up_loc (input_location, TYPE_SIZE_UNIT (type),
TYPE_ALIGN_UNIT (type)); TYPE_ALIGN_UNIT (type));
} }
@ -1959,7 +1963,8 @@ layout_type (tree type)
that (possible) negative values are handled appropriately. */ that (possible) negative values are handled appropriately. */
length = size_binop (PLUS_EXPR, size_one_node, length = size_binop (PLUS_EXPR, size_one_node,
fold_convert (sizetype, fold_convert (sizetype,
fold_build2 (MINUS_EXPR, fold_build2_loc (input_location,
MINUS_EXPR,
TREE_TYPE (lb), TREE_TYPE (lb),
ub, lb))); ub, lb)));

View File

@ -1,3 +1,10 @@
2009-07-17 Aldy Hernandez <aldyh@redhat.com>
Manuel López-Ibáñez <manu@gcc.gnu.org>
PR 40435
* gcc.dg/pr36902.c: Add column info.
* g++.dg/gcov/gcov-2.C: Change count for definition.
2009-07-16 Jason Merrill <jason@redhat.com> 2009-07-16 Jason Merrill <jason@redhat.com>
PR libstdc++/37907 PR libstdc++/37907

View File

@ -20,7 +20,7 @@ private:
void foo() void foo()
{ {
C c; /* count(1) */ C c; /* count(2) */
c.seti (1); /* count(1) */ c.seti (1); /* count(1) */
} }

View File

@ -44,7 +44,7 @@ foo2(unsigned char * to, const unsigned char * from, int n)
*to = *from; *to = *from;
break; break;
case 5: case 5:
to[4] = from [4]; /* { dg-warning "array subscript is above array bounds" } */ to[4] = from [4]; /* { dg-warning "20:array subscript is above array bounds" } */
break; break;
} }
return to; return to;

View File

@ -476,11 +476,12 @@ fold_cond_expr_cond (void)
if (stmt && gimple_code (stmt) == GIMPLE_COND) if (stmt && gimple_code (stmt) == GIMPLE_COND)
{ {
location_t loc = gimple_location (stmt);
tree cond; tree cond;
bool zerop, onep; bool zerop, onep;
fold_defer_overflow_warnings (); fold_defer_overflow_warnings ();
cond = fold_binary (gimple_cond_code (stmt), boolean_type_node, cond = fold_binary_loc (loc, gimple_cond_code (stmt), boolean_type_node,
gimple_cond_lhs (stmt), gimple_cond_rhs (stmt)); gimple_cond_lhs (stmt), gimple_cond_rhs (stmt));
if (cond) if (cond)
{ {
@ -7196,8 +7197,9 @@ gimplify_build3 (gimple_stmt_iterator *gsi, enum tree_code code,
tree type, tree a, tree b, tree c) tree type, tree a, tree b, tree c)
{ {
tree ret; tree ret;
location_t loc = gimple_location (gsi_stmt (*gsi));
ret = fold_build3 (code, type, a, b, c); ret = fold_build3_loc (loc, code, type, a, b, c);
STRIP_NOPS (ret); STRIP_NOPS (ret);
return force_gimple_operand_gsi (gsi, ret, true, NULL, true, return force_gimple_operand_gsi (gsi, ret, true, NULL, true,
@ -7213,7 +7215,7 @@ gimplify_build2 (gimple_stmt_iterator *gsi, enum tree_code code,
{ {
tree ret; tree ret;
ret = fold_build2 (code, type, a, b); ret = fold_build2_loc (gimple_location (gsi_stmt (*gsi)), code, type, a, b);
STRIP_NOPS (ret); STRIP_NOPS (ret);
return force_gimple_operand_gsi (gsi, ret, true, NULL, true, return force_gimple_operand_gsi (gsi, ret, true, NULL, true,
@ -7229,7 +7231,7 @@ gimplify_build1 (gimple_stmt_iterator *gsi, enum tree_code code, tree type,
{ {
tree ret; tree ret;
ret = fold_build1 (code, type, a); ret = fold_build1_loc (gimple_location (gsi_stmt (*gsi)), code, type, a);
STRIP_NOPS (ret); STRIP_NOPS (ret);
return force_gimple_operand_gsi (gsi, ret, true, NULL, true, return force_gimple_operand_gsi (gsi, ret, true, NULL, true,

View File

@ -1109,7 +1109,8 @@ expand_complex_div_wide (gimple_stmt_iterator *gsi, tree inner_type,
/* Examine |br| < |bi|, and branch. */ /* Examine |br| < |bi|, and branch. */
t1 = gimplify_build1 (gsi, ABS_EXPR, inner_type, br); t1 = gimplify_build1 (gsi, ABS_EXPR, inner_type, br);
t2 = gimplify_build1 (gsi, ABS_EXPR, inner_type, bi); t2 = gimplify_build1 (gsi, ABS_EXPR, inner_type, bi);
compare = fold_build2 (LT_EXPR, boolean_type_node, t1, t2); compare = fold_build2_loc (gimple_location (gsi_stmt (*gsi)),
LT_EXPR, boolean_type_node, t1, t2);
STRIP_NOPS (compare); STRIP_NOPS (compare);
bb_cond = bb_true = bb_false = bb_join = NULL; bb_cond = bb_true = bb_false = bb_join = NULL;
@ -1130,7 +1131,8 @@ expand_complex_div_wide (gimple_stmt_iterator *gsi, tree inner_type,
gsi_insert_before (gsi, stmt, GSI_SAME_STMT); gsi_insert_before (gsi, stmt, GSI_SAME_STMT);
cond = fold_build2 (EQ_EXPR, boolean_type_node, tmp, boolean_true_node); cond = fold_build2_loc (gimple_location (stmt),
EQ_EXPR, boolean_type_node, tmp, boolean_true_node);
stmt = gimple_build_cond_from_tree (cond, NULL_TREE, NULL_TREE); stmt = gimple_build_cond_from_tree (cond, NULL_TREE, NULL_TREE);
gsi_insert_before (gsi, stmt, GSI_SAME_STMT); gsi_insert_before (gsi, stmt, GSI_SAME_STMT);

View File

@ -271,10 +271,11 @@ tree_if_convert_cond_stmt (struct loop *loop, gimple stmt, tree cond,
{ {
tree c, c2; tree c, c2;
edge true_edge, false_edge; edge true_edge, false_edge;
location_t loc = gimple_location (stmt);
gcc_assert (gimple_code (stmt) == GIMPLE_COND); gcc_assert (gimple_code (stmt) == GIMPLE_COND);
c = fold_build2 (gimple_cond_code (stmt), boolean_type_node, c = fold_build2_loc (loc, gimple_cond_code (stmt), boolean_type_node,
gimple_cond_lhs (stmt), gimple_cond_rhs (stmt)); gimple_cond_lhs (stmt), gimple_cond_rhs (stmt));
extract_true_false_edges_from_block (gimple_bb (stmt), extract_true_false_edges_from_block (gimple_bb (stmt),
@ -286,7 +287,7 @@ tree_if_convert_cond_stmt (struct loop *loop, gimple stmt, tree cond,
add_to_dst_predicate_list (loop, true_edge, cond, c, gsi); add_to_dst_predicate_list (loop, true_edge, cond, c, gsi);
/* If 'c' is false then FALSE_EDGE is taken. */ /* If 'c' is false then FALSE_EDGE is taken. */
c2 = invert_truthvalue (unshare_expr (c)); c2 = invert_truthvalue_loc (loc, unshare_expr (c));
add_to_dst_predicate_list (loop, false_edge, cond, c2, gsi); add_to_dst_predicate_list (loop, false_edge, cond, c2, gsi);
/* Now this conditional statement is redundant. Remove it. /* Now this conditional statement is redundant. Remove it.
@ -615,7 +616,8 @@ add_to_predicate_list (basic_block bb, tree new_cond)
tree cond = (tree) bb->aux; tree cond = (tree) bb->aux;
if (cond) if (cond)
cond = fold_build2 (TRUTH_OR_EXPR, boolean_type_node, cond = fold_build2_loc (EXPR_LOCATION (cond),
TRUTH_OR_EXPR, boolean_type_node,
unshare_expr (cond), new_cond); unshare_expr (cond), new_cond);
else else
cond = new_cond; cond = new_cond;

View File

@ -778,7 +778,8 @@ remap_gimple_op_r (tree *tp, int *walk_subtrees, void *data)
{ {
if (TREE_CODE (new_tree) == ADDR_EXPR) if (TREE_CODE (new_tree) == ADDR_EXPR)
{ {
*tp = fold_indirect_ref_1 (type, new_tree); *tp = fold_indirect_ref_1 (EXPR_LOCATION (new_tree),
type, new_tree);
/* ??? We should either assert here or build /* ??? We should either assert here or build
a VIEW_CONVERT_EXPR instead of blindly leaking a VIEW_CONVERT_EXPR instead of blindly leaking
incompatible types to our IL. */ incompatible types to our IL. */
@ -1010,7 +1011,8 @@ copy_tree_body_r (tree *tp, int *walk_subtrees, void *data)
{ {
if (TREE_CODE (new_tree) == ADDR_EXPR) if (TREE_CODE (new_tree) == ADDR_EXPR)
{ {
*tp = fold_indirect_ref_1 (type, new_tree); *tp = fold_indirect_ref_1 (EXPR_LOCATION (new_tree),
type, new_tree);
/* ??? We should either assert here or build /* ??? We should either assert here or build
a VIEW_CONVERT_EXPR instead of blindly leaking a VIEW_CONVERT_EXPR instead of blindly leaking
incompatible types to our IL. */ incompatible types to our IL. */

View File

@ -219,15 +219,15 @@ generate_loops_for_partition (struct loop *loop, bitmap partition, bool copy_p)
/* Build the size argument for a memset call. */ /* Build the size argument for a memset call. */
static inline tree static inline tree
build_size_arg (tree nb_iter, tree op, gimple_seq* stmt_list) build_size_arg_loc (location_t loc, tree nb_iter, tree op, gimple_seq* stmt_list)
{ {
tree nb_bytes; tree nb_bytes;
gimple_seq stmts = NULL; gimple_seq stmts = NULL;
nb_bytes = fold_build2 (MULT_EXPR, size_type_node, nb_bytes = fold_build2_loc (loc, MULT_EXPR, size_type_node,
fold_convert (size_type_node, nb_iter), fold_convert_loc (loc, size_type_node, nb_iter),
fold_convert (size_type_node, fold_convert_loc (loc, size_type_node,
TYPE_SIZE_UNIT (TREE_TYPE (op)))); TYPE_SIZE_UNIT (TREE_TYPE (op))));
nb_bytes = force_gimple_operand (nb_bytes, &stmts, true, NULL); nb_bytes = force_gimple_operand (nb_bytes, &stmts, true, NULL);
gimple_seq_add_seq (stmt_list, stmts); gimple_seq_add_seq (stmt_list, stmts);
@ -248,6 +248,7 @@ generate_memset_zero (gimple stmt, tree op0, tree nb_iter,
tree mem, fndecl, fntype, fn; tree mem, fndecl, fntype, fn;
gimple_stmt_iterator i; gimple_stmt_iterator i;
struct data_reference *dr = XCNEW (struct data_reference); struct data_reference *dr = XCNEW (struct data_reference);
location_t loc = gimple_location (stmt);
DR_STMT (dr) = stmt; DR_STMT (dr) = stmt;
DR_REF (dr) = op0; DR_REF (dr) = op0;
@ -255,31 +256,32 @@ generate_memset_zero (gimple stmt, tree op0, tree nb_iter,
goto end; goto end;
/* Test for a positive stride, iterating over every element. */ /* Test for a positive stride, iterating over every element. */
if (integer_zerop (fold_build2 (MINUS_EXPR, integer_type_node, DR_STEP (dr), if (integer_zerop (fold_build2_loc (loc,
MINUS_EXPR, integer_type_node, DR_STEP (dr),
TYPE_SIZE_UNIT (TREE_TYPE (op0))))) TYPE_SIZE_UNIT (TREE_TYPE (op0)))))
{ {
tree offset = fold_convert (sizetype, tree offset = fold_convert_loc (loc, sizetype,
size_binop (PLUS_EXPR, size_binop_loc (loc, PLUS_EXPR,
DR_OFFSET (dr), DR_OFFSET (dr),
DR_INIT (dr))); DR_INIT (dr)));
addr_base = fold_build2 (POINTER_PLUS_EXPR, addr_base = fold_build2_loc (loc, POINTER_PLUS_EXPR,
TREE_TYPE (DR_BASE_ADDRESS (dr)), TREE_TYPE (DR_BASE_ADDRESS (dr)),
DR_BASE_ADDRESS (dr), offset); DR_BASE_ADDRESS (dr), offset);
} }
/* Test for a negative stride, iterating over every element. */ /* Test for a negative stride, iterating over every element. */
else if (integer_zerop (fold_build2 (PLUS_EXPR, integer_type_node, else if (integer_zerop (fold_build2_loc (loc, PLUS_EXPR, integer_type_node,
TYPE_SIZE_UNIT (TREE_TYPE (op0)), TYPE_SIZE_UNIT (TREE_TYPE (op0)),
DR_STEP (dr)))) DR_STEP (dr))))
{ {
nb_bytes = build_size_arg (nb_iter, op0, &stmt_list); nb_bytes = build_size_arg_loc (loc, nb_iter, op0, &stmt_list);
addr_base = size_binop (PLUS_EXPR, DR_OFFSET (dr), DR_INIT (dr)); addr_base = size_binop_loc (loc, PLUS_EXPR, DR_OFFSET (dr), DR_INIT (dr));
addr_base = fold_build2 (MINUS_EXPR, sizetype, addr_base, addr_base = fold_build2_loc (loc, MINUS_EXPR, sizetype, addr_base,
fold_convert (sizetype, nb_bytes)); fold_convert_loc (loc, sizetype, nb_bytes));
addr_base = force_gimple_operand (addr_base, &stmts, true, NULL); addr_base = force_gimple_operand (addr_base, &stmts, true, NULL);
gimple_seq_add_seq (&stmt_list, stmts); gimple_seq_add_seq (&stmt_list, stmts);
addr_base = fold_build2 (POINTER_PLUS_EXPR, addr_base = fold_build2_loc (loc, POINTER_PLUS_EXPR,
TREE_TYPE (DR_BASE_ADDRESS (dr)), TREE_TYPE (DR_BASE_ADDRESS (dr)),
DR_BASE_ADDRESS (dr), addr_base); DR_BASE_ADDRESS (dr), addr_base);
} }
@ -294,7 +296,7 @@ generate_memset_zero (gimple stmt, tree op0, tree nb_iter,
fn = build1 (ADDR_EXPR, build_pointer_type (fntype), fndecl); fn = build1 (ADDR_EXPR, build_pointer_type (fntype), fndecl);
if (!nb_bytes) if (!nb_bytes)
nb_bytes = build_size_arg (nb_iter, op0, &stmt_list); nb_bytes = build_size_arg_loc (loc, nb_iter, op0, &stmt_list);
fn_call = gimple_build_call (fn, 3, mem, integer_zero_node, nb_bytes); fn_call = gimple_build_call (fn, 3, mem, integer_zero_node, nb_bytes);
gimple_seq_add_stmt (&stmt_list, fn_call); gimple_seq_add_stmt (&stmt_list, fn_call);

View File

@ -581,7 +581,8 @@ mf_build_check_statement_for (tree base, tree limit,
/* Build: __mf_base = (uintptr_t) <base address expression>. */ /* Build: __mf_base = (uintptr_t) <base address expression>. */
seq = gimple_seq_alloc (); seq = gimple_seq_alloc ();
t = fold_convert (mf_uintptr_type, unshare_expr (base)); t = fold_convert_loc (location, mf_uintptr_type,
unshare_expr (base));
t = force_gimple_operand (t, &stmts, false, NULL_TREE); t = force_gimple_operand (t, &stmts, false, NULL_TREE);
gimple_seq_add_seq (&seq, stmts); gimple_seq_add_seq (&seq, stmts);
g = gimple_build_assign (mf_base, t); g = gimple_build_assign (mf_base, t);
@ -589,7 +590,8 @@ mf_build_check_statement_for (tree base, tree limit,
gimple_seq_add_stmt (&seq, g); gimple_seq_add_stmt (&seq, g);
/* Build: __mf_limit = (uintptr_t) <limit address expression>. */ /* Build: __mf_limit = (uintptr_t) <limit address expression>. */
t = fold_convert (mf_uintptr_type, unshare_expr (limit)); t = fold_convert_loc (location, mf_uintptr_type,
unshare_expr (limit));
t = force_gimple_operand (t, &stmts, false, NULL_TREE); t = force_gimple_operand (t, &stmts, false, NULL_TREE);
gimple_seq_add_seq (&seq, stmts); gimple_seq_add_seq (&seq, stmts);
g = gimple_build_assign (mf_limit, t); g = gimple_build_assign (mf_limit, t);
@ -693,8 +695,9 @@ mf_build_check_statement_for (tree base, tree limit,
/* u is a string, so it is already a gimple value. */ /* u is a string, so it is already a gimple value. */
u = mf_file_function_line_tree (location); u = mf_file_function_line_tree (location);
/* NB: we pass the overall [base..limit] range to mf_check. */ /* NB: we pass the overall [base..limit] range to mf_check. */
v = fold_build2 (PLUS_EXPR, mf_uintptr_type, v = fold_build2_loc (location, PLUS_EXPR, mf_uintptr_type,
fold_build2 (MINUS_EXPR, mf_uintptr_type, mf_limit, mf_base), fold_build2_loc (location,
MINUS_EXPR, mf_uintptr_type, mf_limit, mf_base),
build_int_cst (mf_uintptr_type, 1)); build_int_cst (mf_uintptr_type, 1));
v = force_gimple_operand (v, &stmts, true, NULL_TREE); v = force_gimple_operand (v, &stmts, true, NULL_TREE);
gimple_seq_add_seq (&seq, stmts); gimple_seq_add_seq (&seq, stmts);
@ -863,16 +866,16 @@ mf_xform_derefs_1 (gimple_stmt_iterator *iter, tree *tp,
if (elt) if (elt)
elt = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (elt)), elt = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (elt)),
elt); elt);
addr = fold_convert (ptr_type_node, elt ? elt : base); addr = fold_convert_loc (location, ptr_type_node, elt ? elt : base);
addr = fold_build2 (POINTER_PLUS_EXPR, ptr_type_node, addr = fold_build2_loc (location, POINTER_PLUS_EXPR, ptr_type_node,
addr, fold_convert (sizetype, addr, fold_convert_loc (location, sizetype,
byte_position (field))); byte_position (field)));
} }
else else
addr = build1 (ADDR_EXPR, build_pointer_type (type), t); addr = build1 (ADDR_EXPR, build_pointer_type (type), t);
limit = fold_build2 (MINUS_EXPR, mf_uintptr_type, limit = fold_build2_loc (location, MINUS_EXPR, mf_uintptr_type,
fold_build2 (PLUS_EXPR, mf_uintptr_type, fold_build2_loc (location, PLUS_EXPR, mf_uintptr_type,
convert (mf_uintptr_type, addr), convert (mf_uintptr_type, addr),
size), size),
integer_one_node); integer_one_node);
@ -882,8 +885,9 @@ mf_xform_derefs_1 (gimple_stmt_iterator *iter, tree *tp,
case INDIRECT_REF: case INDIRECT_REF:
addr = TREE_OPERAND (t, 0); addr = TREE_OPERAND (t, 0);
base = addr; base = addr;
limit = fold_build2 (POINTER_PLUS_EXPR, ptr_type_node, limit = fold_build2_loc (location, POINTER_PLUS_EXPR, ptr_type_node,
fold_build2 (POINTER_PLUS_EXPR, ptr_type_node, base, fold_build2_loc (location,
POINTER_PLUS_EXPR, ptr_type_node, base,
size), size),
size_int (-1)); size_int (-1));
break; break;
@ -891,8 +895,9 @@ mf_xform_derefs_1 (gimple_stmt_iterator *iter, tree *tp,
case TARGET_MEM_REF: case TARGET_MEM_REF:
addr = tree_mem_ref_addr (ptr_type_node, t); addr = tree_mem_ref_addr (ptr_type_node, t);
base = addr; base = addr;
limit = fold_build2 (POINTER_PLUS_EXPR, ptr_type_node, limit = fold_build2_loc (location, POINTER_PLUS_EXPR, ptr_type_node,
fold_build2 (POINTER_PLUS_EXPR, ptr_type_node, base, fold_build2_loc (location,
POINTER_PLUS_EXPR, ptr_type_node, base,
size), size),
size_int (-1)); size_int (-1));
break; break;
@ -914,21 +919,26 @@ mf_xform_derefs_1 (gimple_stmt_iterator *iter, tree *tp,
bpu = bitsize_int (BITS_PER_UNIT); bpu = bitsize_int (BITS_PER_UNIT);
ofs = convert (bitsizetype, TREE_OPERAND (t, 2)); ofs = convert (bitsizetype, TREE_OPERAND (t, 2));
rem = size_binop (TRUNC_MOD_EXPR, ofs, bpu); rem = size_binop_loc (location, TRUNC_MOD_EXPR, ofs, bpu);
ofs = fold_convert (sizetype, size_binop (TRUNC_DIV_EXPR, ofs, bpu)); ofs = fold_convert_loc (location,
sizetype,
size_binop_loc (location,
TRUNC_DIV_EXPR, ofs, bpu));
size = convert (bitsizetype, TREE_OPERAND (t, 1)); size = convert (bitsizetype, TREE_OPERAND (t, 1));
size = size_binop (PLUS_EXPR, size, rem); size = size_binop_loc (location, PLUS_EXPR, size, rem);
size = size_binop (CEIL_DIV_EXPR, size, bpu); size = size_binop_loc (location, CEIL_DIV_EXPR, size, bpu);
size = convert (sizetype, size); size = convert (sizetype, size);
addr = TREE_OPERAND (TREE_OPERAND (t, 0), 0); addr = TREE_OPERAND (TREE_OPERAND (t, 0), 0);
addr = convert (ptr_type_node, addr); addr = convert (ptr_type_node, addr);
addr = fold_build2 (POINTER_PLUS_EXPR, ptr_type_node, addr, ofs); addr = fold_build2_loc (location, POINTER_PLUS_EXPR,
ptr_type_node, addr, ofs);
base = addr; base = addr;
limit = fold_build2 (POINTER_PLUS_EXPR, ptr_type_node, limit = fold_build2_loc (location, POINTER_PLUS_EXPR, ptr_type_node,
fold_build2 (POINTER_PLUS_EXPR, ptr_type_node, fold_build2_loc (location,
POINTER_PLUS_EXPR, ptr_type_node,
base, size), base, size),
size_int (-1)); size_int (-1));
} }

View File

@ -1123,11 +1123,13 @@ static bool
build_ref_for_offset (tree *expr, tree type, HOST_WIDE_INT offset, build_ref_for_offset (tree *expr, tree type, HOST_WIDE_INT offset,
tree exp_type, bool allow_ptr) tree exp_type, bool allow_ptr)
{ {
location_t loc = expr ? EXPR_LOCATION (*expr) : UNKNOWN_LOCATION;
if (allow_ptr && POINTER_TYPE_P (type)) if (allow_ptr && POINTER_TYPE_P (type))
{ {
type = TREE_TYPE (type); type = TREE_TYPE (type);
if (expr) if (expr)
*expr = fold_build1 (INDIRECT_REF, type, *expr); *expr = fold_build1_loc (loc, INDIRECT_REF, type, *expr);
} }
return build_ref_for_offset_1 (expr, type, offset, exp_type); return build_ref_for_offset_1 (expr, type, offset, exp_type);
@ -1968,6 +1970,7 @@ load_assign_lhs_subreplacements (struct access *lacc, struct access *top_racc,
enum unscalarized_data_handling *refreshed, enum unscalarized_data_handling *refreshed,
tree lhs) tree lhs)
{ {
location_t loc = EXPR_LOCATION (lacc->expr);
do do
{ {
if (lacc->grp_to_be_replaced) if (lacc->grp_to_be_replaced)
@ -1982,7 +1985,7 @@ load_assign_lhs_subreplacements (struct access *lacc, struct access *top_racc,
{ {
rhs = get_access_replacement (racc); rhs = get_access_replacement (racc);
if (!useless_type_conversion_p (lacc->type, racc->type)) if (!useless_type_conversion_p (lacc->type, racc->type))
rhs = fold_build1 (VIEW_CONVERT_EXPR, lacc->type, rhs); rhs = fold_build1_loc (loc, VIEW_CONVERT_EXPR, lacc->type, rhs);
} }
else else
{ {
@ -2080,6 +2083,7 @@ sra_modify_assign (gimple *stmt, gimple_stmt_iterator *gsi,
tree lhs, rhs; tree lhs, rhs;
bool modify_this_stmt = false; bool modify_this_stmt = false;
bool force_gimple_rhs = false; bool force_gimple_rhs = false;
location_t loc = gimple_location (*stmt);
if (!gimple_assign_single_p (*stmt)) if (!gimple_assign_single_p (*stmt))
return SRA_SA_NONE; return SRA_SA_NONE;
@ -2152,7 +2156,7 @@ sra_modify_assign (gimple *stmt, gimple_stmt_iterator *gsi,
} }
if (!useless_type_conversion_p (TREE_TYPE (lhs), TREE_TYPE (rhs))) if (!useless_type_conversion_p (TREE_TYPE (lhs), TREE_TYPE (rhs)))
{ {
rhs = fold_build1 (VIEW_CONVERT_EXPR, TREE_TYPE (lhs), rhs); rhs = fold_build1_loc (loc, VIEW_CONVERT_EXPR, TREE_TYPE (lhs), rhs);
if (!is_gimple_reg (lhs)) if (!is_gimple_reg (lhs))
force_gimple_rhs = true; force_gimple_rhs = true;
} }

View File

@ -910,6 +910,7 @@ may_propagate_address_into_dereference (tree addr, tree deref)
static tree static tree
ccp_fold (gimple stmt) ccp_fold (gimple stmt)
{ {
location_t loc = gimple_location (stmt);
switch (gimple_code (stmt)) switch (gimple_code (stmt))
{ {
case GIMPLE_ASSIGN: case GIMPLE_ASSIGN:
@ -992,7 +993,8 @@ ccp_fold (gimple stmt)
{ {
prop_value_t *val = get_value (TREE_OPERAND (rhs, 0)); prop_value_t *val = get_value (TREE_OPERAND (rhs, 0));
if (val->lattice_val == CONSTANT) if (val->lattice_val == CONSTANT)
return fold_unary (TREE_CODE (rhs), return fold_unary_loc (EXPR_LOCATION (rhs),
TREE_CODE (rhs),
TREE_TYPE (rhs), val->value); TREE_TYPE (rhs), val->value);
} }
else if (TREE_CODE (rhs) == INDIRECT_REF else if (TREE_CODE (rhs) == INDIRECT_REF
@ -1048,15 +1050,16 @@ ccp_fold (gimple stmt)
if (!useless_type_conversion_p (TREE_TYPE (lhs), if (!useless_type_conversion_p (TREE_TYPE (lhs),
TREE_TYPE (op0)) TREE_TYPE (op0))
&& ((tem = maybe_fold_offset_to_address && ((tem = maybe_fold_offset_to_address
(gimple_location (stmt), (loc,
op0, integer_zero_node, TREE_TYPE (lhs))) op0, integer_zero_node, TREE_TYPE (lhs)))
!= NULL_TREE)) != NULL_TREE))
return tem; return tem;
return op0; return op0;
} }
return fold_unary_ignore_overflow (subcode, return
gimple_expr_type (stmt), op0); fold_unary_ignore_overflow_loc (loc, subcode,
gimple_expr_type (stmt), op0);
} }
case GIMPLE_BINARY_RHS: case GIMPLE_BINARY_RHS:
@ -1087,12 +1090,13 @@ ccp_fold (gimple stmt)
{ {
tree lhs = gimple_assign_lhs (stmt); tree lhs = gimple_assign_lhs (stmt);
tree tem = maybe_fold_offset_to_address tree tem = maybe_fold_offset_to_address
(gimple_location (stmt), op0, op1, TREE_TYPE (lhs)); (loc, op0, op1, TREE_TYPE (lhs));
if (tem != NULL_TREE) if (tem != NULL_TREE)
return tem; return tem;
} }
return fold_binary (subcode, gimple_expr_type (stmt), op0, op1); return fold_binary_loc (loc, subcode,
gimple_expr_type (stmt), op0, op1);
} }
default: default:
@ -1129,9 +1133,10 @@ ccp_fold (gimple stmt)
args[i] = val->value; args[i] = val->value;
} }
} }
call = build_call_array (gimple_call_return_type (stmt), call = build_call_array_loc (loc,
fn, gimple_call_num_args (stmt), args); gimple_call_return_type (stmt),
retval = fold_call_expr (call, false); fn, gimple_call_num_args (stmt), args);
retval = fold_call_expr (EXPR_LOCATION (call), call, false);
if (retval) if (retval)
/* fold_call_expr wraps the result inside a NOP_EXPR. */ /* fold_call_expr wraps the result inside a NOP_EXPR. */
STRIP_NOPS (retval); STRIP_NOPS (retval);
@ -1162,7 +1167,7 @@ ccp_fold (gimple stmt)
op1 = val->value; op1 = val->value;
} }
return fold_binary (code, boolean_type_node, op0, op1); return fold_binary_loc (loc, code, boolean_type_node, op0, op1);
} }
case GIMPLE_SWITCH: case GIMPLE_SWITCH:
@ -1344,7 +1349,8 @@ fold_const_aggregate_ref (tree t)
{ {
tree c = fold_const_aggregate_ref (TREE_OPERAND (t, 0)); tree c = fold_const_aggregate_ref (TREE_OPERAND (t, 0));
if (c && TREE_CODE (c) == COMPLEX_CST) if (c && TREE_CODE (c) == COMPLEX_CST)
return fold_build1 (TREE_CODE (t), TREE_TYPE (t), c); return fold_build1_loc (EXPR_LOCATION (t),
TREE_CODE (t), TREE_TYPE (t), c);
break; break;
} }
@ -2049,9 +2055,7 @@ maybe_fold_offset_to_address (location_t loc, tree addr, tree offset,
ptr_type = build_pointer_type (TREE_TYPE (t)); ptr_type = build_pointer_type (TREE_TYPE (t));
if (!useless_type_conversion_p (orig_type, ptr_type)) if (!useless_type_conversion_p (orig_type, ptr_type))
return NULL_TREE; return NULL_TREE;
t = build_fold_addr_expr_with_type (t, ptr_type); return build_fold_addr_expr_with_type_loc (loc, t, ptr_type);
protected_set_expr_location (t, loc);
return t;
} }
return NULL_TREE; return NULL_TREE;
@ -2471,6 +2475,7 @@ ccp_fold_builtin (gimple stmt)
bitmap visited; bitmap visited;
bool ignore; bool ignore;
int nargs; int nargs;
location_t loc = gimple_location (stmt);
gcc_assert (is_gimple_call (stmt)); gcc_assert (is_gimple_call (stmt));
@ -2567,7 +2572,7 @@ ccp_fold_builtin (gimple stmt)
case BUILT_IN_STRCPY: case BUILT_IN_STRCPY:
if (val[1] && is_gimple_val (val[1]) && nargs == 2) if (val[1] && is_gimple_val (val[1]) && nargs == 2)
result = fold_builtin_strcpy (callee, result = fold_builtin_strcpy (loc, callee,
gimple_call_arg (stmt, 0), gimple_call_arg (stmt, 0),
gimple_call_arg (stmt, 1), gimple_call_arg (stmt, 1),
val[1]); val[1]);
@ -2575,7 +2580,7 @@ ccp_fold_builtin (gimple stmt)
case BUILT_IN_STRNCPY: case BUILT_IN_STRNCPY:
if (val[1] && is_gimple_val (val[1]) && nargs == 3) if (val[1] && is_gimple_val (val[1]) && nargs == 3)
result = fold_builtin_strncpy (callee, result = fold_builtin_strncpy (loc, callee,
gimple_call_arg (stmt, 0), gimple_call_arg (stmt, 0),
gimple_call_arg (stmt, 1), gimple_call_arg (stmt, 1),
gimple_call_arg (stmt, 2), gimple_call_arg (stmt, 2),
@ -2584,14 +2589,14 @@ ccp_fold_builtin (gimple stmt)
case BUILT_IN_FPUTS: case BUILT_IN_FPUTS:
if (nargs == 2) if (nargs == 2)
result = fold_builtin_fputs (gimple_call_arg (stmt, 0), result = fold_builtin_fputs (loc, gimple_call_arg (stmt, 0),
gimple_call_arg (stmt, 1), gimple_call_arg (stmt, 1),
ignore, false, val[0]); ignore, false, val[0]);
break; break;
case BUILT_IN_FPUTS_UNLOCKED: case BUILT_IN_FPUTS_UNLOCKED:
if (nargs == 2) if (nargs == 2)
result = fold_builtin_fputs (gimple_call_arg (stmt, 0), result = fold_builtin_fputs (loc, gimple_call_arg (stmt, 0),
gimple_call_arg (stmt, 1), gimple_call_arg (stmt, 1),
ignore, true, val[0]); ignore, true, val[0]);
break; break;
@ -2601,7 +2606,7 @@ ccp_fold_builtin (gimple stmt)
case BUILT_IN_MEMMOVE_CHK: case BUILT_IN_MEMMOVE_CHK:
case BUILT_IN_MEMSET_CHK: case BUILT_IN_MEMSET_CHK:
if (val[2] && is_gimple_val (val[2]) && nargs == 4) if (val[2] && is_gimple_val (val[2]) && nargs == 4)
result = fold_builtin_memory_chk (callee, result = fold_builtin_memory_chk (loc, callee,
gimple_call_arg (stmt, 0), gimple_call_arg (stmt, 0),
gimple_call_arg (stmt, 1), gimple_call_arg (stmt, 1),
gimple_call_arg (stmt, 2), gimple_call_arg (stmt, 2),
@ -2613,7 +2618,7 @@ ccp_fold_builtin (gimple stmt)
case BUILT_IN_STRCPY_CHK: case BUILT_IN_STRCPY_CHK:
case BUILT_IN_STPCPY_CHK: case BUILT_IN_STPCPY_CHK:
if (val[1] && is_gimple_val (val[1]) && nargs == 3) if (val[1] && is_gimple_val (val[1]) && nargs == 3)
result = fold_builtin_stxcpy_chk (callee, result = fold_builtin_stxcpy_chk (loc, callee,
gimple_call_arg (stmt, 0), gimple_call_arg (stmt, 0),
gimple_call_arg (stmt, 1), gimple_call_arg (stmt, 1),
gimple_call_arg (stmt, 2), gimple_call_arg (stmt, 2),
@ -2623,7 +2628,7 @@ ccp_fold_builtin (gimple stmt)
case BUILT_IN_STRNCPY_CHK: case BUILT_IN_STRNCPY_CHK:
if (val[2] && is_gimple_val (val[2]) && nargs == 4) if (val[2] && is_gimple_val (val[2]) && nargs == 4)
result = fold_builtin_strncpy_chk (gimple_call_arg (stmt, 0), result = fold_builtin_strncpy_chk (loc, gimple_call_arg (stmt, 0),
gimple_call_arg (stmt, 1), gimple_call_arg (stmt, 1),
gimple_call_arg (stmt, 2), gimple_call_arg (stmt, 2),
gimple_call_arg (stmt, 3), gimple_call_arg (stmt, 3),
@ -2656,6 +2661,7 @@ fold_gimple_assign (gimple_stmt_iterator *si)
{ {
gimple stmt = gsi_stmt (*si); gimple stmt = gsi_stmt (*si);
enum tree_code subcode = gimple_assign_rhs_code (stmt); enum tree_code subcode = gimple_assign_rhs_code (stmt);
location_t loc = gimple_location (stmt);
tree result = NULL_TREE; tree result = NULL_TREE;
@ -2671,11 +2677,13 @@ fold_gimple_assign (gimple_stmt_iterator *si)
tree op0 = COND_EXPR_COND (rhs); tree op0 = COND_EXPR_COND (rhs);
tree tem; tree tem;
bool set = false; bool set = false;
location_t cond_loc = EXPR_LOCATION (rhs);
if (COMPARISON_CLASS_P (op0)) if (COMPARISON_CLASS_P (op0))
{ {
fold_defer_overflow_warnings (); fold_defer_overflow_warnings ();
tem = fold_binary (TREE_CODE (op0), TREE_TYPE (op0), tem = fold_binary_loc (cond_loc,
TREE_CODE (op0), TREE_TYPE (op0),
TREE_OPERAND (op0, 0), TREE_OPERAND (op0, 0),
TREE_OPERAND (op0, 1)); TREE_OPERAND (op0, 1));
/* This is actually a conditional expression, not a GIMPLE /* This is actually a conditional expression, not a GIMPLE
@ -2694,7 +2702,7 @@ fold_gimple_assign (gimple_stmt_iterator *si)
return NULL_TREE; return NULL_TREE;
if (set) if (set)
result = fold_build3 (COND_EXPR, TREE_TYPE (rhs), tem, result = fold_build3_loc (cond_loc, COND_EXPR, TREE_TYPE (rhs), tem,
COND_EXPR_THEN (rhs), COND_EXPR_ELSE (rhs)); COND_EXPR_THEN (rhs), COND_EXPR_ELSE (rhs));
} }
@ -2709,7 +2717,7 @@ fold_gimple_assign (gimple_stmt_iterator *si)
tree tem = maybe_fold_reference (TREE_OPERAND (rhs, 0), true); tree tem = maybe_fold_reference (TREE_OPERAND (rhs, 0), true);
if (tem) if (tem)
result = fold_convert (TREE_TYPE (rhs), result = fold_convert (TREE_TYPE (rhs),
build_fold_addr_expr (tem)); build_fold_addr_expr_loc (loc, tem));
} }
else if (TREE_CODE (rhs) == CONSTRUCTOR else if (TREE_CODE (rhs) == CONSTRUCTOR
@ -2752,7 +2760,7 @@ fold_gimple_assign (gimple_stmt_iterator *si)
{ {
tree rhs = gimple_assign_rhs1 (stmt); tree rhs = gimple_assign_rhs1 (stmt);
result = fold_unary (subcode, gimple_expr_type (stmt), rhs); result = fold_unary_loc (loc, subcode, gimple_expr_type (stmt), rhs);
if (result) if (result)
{ {
/* If the operation was a conversion do _not_ mark a /* If the operation was a conversion do _not_ mark a
@ -2774,7 +2782,7 @@ fold_gimple_assign (gimple_stmt_iterator *si)
&& POINTER_TYPE_P (TREE_TYPE (gimple_assign_rhs1 (stmt)))) && POINTER_TYPE_P (TREE_TYPE (gimple_assign_rhs1 (stmt))))
{ {
tree type = gimple_expr_type (stmt); tree type = gimple_expr_type (stmt);
tree t = maybe_fold_offset_to_address (gimple_location (stmt), tree t = maybe_fold_offset_to_address (loc,
gimple_assign_rhs1 (stmt), gimple_assign_rhs1 (stmt),
integer_zero_node, type); integer_zero_node, type);
if (t) if (t)
@ -2802,7 +2810,7 @@ fold_gimple_assign (gimple_stmt_iterator *si)
} }
if (!result) if (!result)
result = fold_binary (subcode, result = fold_binary_loc (loc, subcode,
TREE_TYPE (gimple_assign_lhs (stmt)), TREE_TYPE (gimple_assign_lhs (stmt)),
gimple_assign_rhs1 (stmt), gimple_assign_rhs1 (stmt),
gimple_assign_rhs2 (stmt)); gimple_assign_rhs2 (stmt));
@ -2841,7 +2849,8 @@ fold_gimple_assign (gimple_stmt_iterator *si)
static bool static bool
fold_gimple_cond (gimple stmt) fold_gimple_cond (gimple stmt)
{ {
tree result = fold_binary (gimple_cond_code (stmt), tree result = fold_binary_loc (gimple_location (stmt),
gimple_cond_code (stmt),
boolean_type_node, boolean_type_node,
gimple_cond_lhs (stmt), gimple_cond_lhs (stmt),
gimple_cond_rhs (stmt)); gimple_cond_rhs (stmt));
@ -3120,6 +3129,7 @@ optimize_stdarg_builtin (gimple call)
{ {
tree callee, lhs, rhs, cfun_va_list; tree callee, lhs, rhs, cfun_va_list;
bool va_list_simple_ptr; bool va_list_simple_ptr;
location_t loc = gimple_location (call);
if (gimple_code (call) != GIMPLE_CALL) if (gimple_code (call) != GIMPLE_CALL)
return NULL_TREE; return NULL_TREE;
@ -3148,10 +3158,10 @@ optimize_stdarg_builtin (gimple call)
!= TYPE_MAIN_VARIANT (cfun_va_list)) != TYPE_MAIN_VARIANT (cfun_va_list))
return NULL_TREE; return NULL_TREE;
lhs = build_fold_indirect_ref (lhs); lhs = build_fold_indirect_ref_loc (loc, lhs);
rhs = build_call_expr (built_in_decls[BUILT_IN_NEXT_ARG], rhs = build_call_expr_loc (loc, built_in_decls[BUILT_IN_NEXT_ARG],
1, integer_zero_node); 1, integer_zero_node);
rhs = fold_convert (TREE_TYPE (lhs), rhs); rhs = fold_convert_loc (loc, TREE_TYPE (lhs), rhs);
return build2 (MODIFY_EXPR, TREE_TYPE (lhs), lhs, rhs); return build2 (MODIFY_EXPR, TREE_TYPE (lhs), lhs, rhs);
case BUILT_IN_VA_COPY: case BUILT_IN_VA_COPY:
@ -3167,13 +3177,13 @@ optimize_stdarg_builtin (gimple call)
!= TYPE_MAIN_VARIANT (cfun_va_list)) != TYPE_MAIN_VARIANT (cfun_va_list))
return NULL_TREE; return NULL_TREE;
lhs = build_fold_indirect_ref (lhs); lhs = build_fold_indirect_ref_loc (loc, lhs);
rhs = gimple_call_arg (call, 1); rhs = gimple_call_arg (call, 1);
if (TYPE_MAIN_VARIANT (TREE_TYPE (rhs)) if (TYPE_MAIN_VARIANT (TREE_TYPE (rhs))
!= TYPE_MAIN_VARIANT (cfun_va_list)) != TYPE_MAIN_VARIANT (cfun_va_list))
return NULL_TREE; return NULL_TREE;
rhs = fold_convert (TREE_TYPE (lhs), rhs); rhs = fold_convert_loc (loc, TREE_TYPE (lhs), rhs);
return build2 (MODIFY_EXPR, TREE_TYPE (lhs), lhs, rhs); return build2 (MODIFY_EXPR, TREE_TYPE (lhs), lhs, rhs);
case BUILT_IN_VA_END: case BUILT_IN_VA_END:

View File

@ -514,6 +514,7 @@ static enum ssa_prop_result
copy_prop_visit_cond_stmt (gimple stmt, edge *taken_edge_p) copy_prop_visit_cond_stmt (gimple stmt, edge *taken_edge_p)
{ {
enum ssa_prop_result retval = SSA_PROP_VARYING; enum ssa_prop_result retval = SSA_PROP_VARYING;
location_t loc = gimple_location (stmt);
tree op0 = gimple_cond_lhs (stmt); tree op0 = gimple_cond_lhs (stmt);
tree op1 = gimple_cond_rhs (stmt); tree op1 = gimple_cond_rhs (stmt);
@ -537,7 +538,7 @@ copy_prop_visit_cond_stmt (gimple stmt, edge *taken_edge_p)
the same SSA_NAME on both sides of a comparison operator. */ the same SSA_NAME on both sides of a comparison operator. */
if (op0 == op1) if (op0 == op1)
{ {
tree folded_cond = fold_binary (gimple_cond_code (stmt), tree folded_cond = fold_binary_loc (loc, gimple_cond_code (stmt),
boolean_type_node, op0, op1); boolean_type_node, op0, op1);
if (folded_cond) if (folded_cond)
{ {

View File

@ -1485,6 +1485,7 @@ record_edge_info (basic_block bb)
if (! gsi_end_p (gsi)) if (! gsi_end_p (gsi))
{ {
gimple stmt = gsi_stmt (gsi); gimple stmt = gsi_stmt (gsi);
location_t loc = gimple_location (stmt);
if (gimple_code (stmt) == GIMPLE_SWITCH) if (gimple_code (stmt) == GIMPLE_SWITCH)
{ {
@ -1517,7 +1518,8 @@ record_edge_info (basic_block bb)
if (label != NULL && label != error_mark_node) if (label != NULL && label != error_mark_node)
{ {
tree x = fold_convert (TREE_TYPE (index), CASE_LOW (label)); tree x = fold_convert_loc (loc, TREE_TYPE (index),
CASE_LOW (label));
edge_info = allocate_edge_info (e); edge_info = allocate_edge_info (e);
edge_info->lhs = index; edge_info->lhs = index;
edge_info->rhs = x; edge_info->rhs = x;
@ -1581,7 +1583,7 @@ record_edge_info (basic_block bb)
|| is_gimple_min_invariant (op1))) || is_gimple_min_invariant (op1)))
{ {
tree cond = build2 (code, boolean_type_node, op0, op1); tree cond = build2 (code, boolean_type_node, op0, op1);
tree inverted = invert_truthvalue (cond); tree inverted = invert_truthvalue_loc (loc, cond);
struct edge_info *edge_info; struct edge_info *edge_info;
edge_info = allocate_edge_info (true_edge); edge_info = allocate_edge_info (true_edge);
@ -1608,7 +1610,7 @@ record_edge_info (basic_block bb)
|| TREE_CODE (op1) == SSA_NAME)) || TREE_CODE (op1) == SSA_NAME))
{ {
tree cond = build2 (code, boolean_type_node, op0, op1); tree cond = build2 (code, boolean_type_node, op0, op1);
tree inverted = invert_truthvalue (cond); tree inverted = invert_truthvalue_loc (loc, cond);
struct edge_info *edge_info; struct edge_info *edge_info;
edge_info = allocate_edge_info (true_edge); edge_info = allocate_edge_info (true_edge);
@ -2218,7 +2220,8 @@ optimize_stmt (basic_block bb, gimple_stmt_iterator si)
tree val = NULL; tree val = NULL;
if (gimple_code (stmt) == GIMPLE_COND) if (gimple_code (stmt) == GIMPLE_COND)
val = fold_binary (gimple_cond_code (stmt), boolean_type_node, val = fold_binary_loc (gimple_location (stmt),
gimple_cond_code (stmt), boolean_type_node,
gimple_cond_lhs (stmt), gimple_cond_rhs (stmt)); gimple_cond_lhs (stmt), gimple_cond_rhs (stmt));
else if (gimple_code (stmt) == GIMPLE_SWITCH) else if (gimple_code (stmt) == GIMPLE_SWITCH)
val = gimple_switch_index (stmt); val = gimple_switch_index (stmt);
@ -2637,7 +2640,8 @@ propagate_rhs_into_lhs (gimple stmt, tree lhs, tree rhs, bitmap interesting_name
tree val; tree val;
if (gimple_code (use_stmt) == GIMPLE_COND) if (gimple_code (use_stmt) == GIMPLE_COND)
val = fold_binary (gimple_cond_code (use_stmt), val = fold_binary_loc (gimple_location (use_stmt),
gimple_cond_code (use_stmt),
boolean_type_node, boolean_type_node,
gimple_cond_lhs (use_stmt), gimple_cond_lhs (use_stmt),
gimple_cond_rhs (use_stmt)); gimple_cond_rhs (use_stmt));

View File

@ -339,9 +339,10 @@ remove_prop_source_from_use (tree name, gimple up_to_stmt)
static tree static tree
rhs_to_tree (tree type, gimple stmt) rhs_to_tree (tree type, gimple stmt)
{ {
location_t loc = gimple_location (stmt);
enum tree_code code = gimple_assign_rhs_code (stmt); enum tree_code code = gimple_assign_rhs_code (stmt);
if (get_gimple_rhs_class (code) == GIMPLE_BINARY_RHS) if (get_gimple_rhs_class (code) == GIMPLE_BINARY_RHS)
return fold_build2 (code, type, gimple_assign_rhs1 (stmt), return fold_build2_loc (loc, code, type, gimple_assign_rhs1 (stmt),
gimple_assign_rhs2 (stmt)); gimple_assign_rhs2 (stmt));
else if (get_gimple_rhs_class (code) == GIMPLE_UNARY_RHS) else if (get_gimple_rhs_class (code) == GIMPLE_UNARY_RHS)
return build1 (code, type, gimple_assign_rhs1 (stmt)); return build1 (code, type, gimple_assign_rhs1 (stmt));
@ -358,14 +359,14 @@ rhs_to_tree (tree type, gimple stmt)
considered simplified. */ considered simplified. */
static tree static tree
combine_cond_expr_cond (enum tree_code code, tree type, combine_cond_expr_cond (location_t loc, enum tree_code code, tree type,
tree op0, tree op1, bool invariant_only) tree op0, tree op1, bool invariant_only)
{ {
tree t; tree t;
gcc_assert (TREE_CODE_CLASS (code) == tcc_comparison); gcc_assert (TREE_CODE_CLASS (code) == tcc_comparison);
t = fold_binary (code, type, op0, op1); t = fold_binary_loc (loc, code, type, op0, op1);
if (!t) if (!t)
return NULL_TREE; return NULL_TREE;
@ -392,7 +393,8 @@ combine_cond_expr_cond (enum tree_code code, tree type,
static int static int
forward_propagate_into_gimple_cond (gimple stmt) forward_propagate_into_gimple_cond (gimple stmt)
{ {
int did_something = 0; int did_something = 0;
location_t loc = gimple_location (stmt);
do { do {
tree tmp = NULL_TREE; tree tmp = NULL_TREE;
@ -413,7 +415,7 @@ forward_propagate_into_gimple_cond (gimple stmt)
{ {
tree op1 = gimple_cond_rhs (stmt); tree op1 = gimple_cond_rhs (stmt);
rhs0 = rhs_to_tree (TREE_TYPE (op1), def_stmt); rhs0 = rhs_to_tree (TREE_TYPE (op1), def_stmt);
tmp = combine_cond_expr_cond (code, boolean_type_node, rhs0, tmp = combine_cond_expr_cond (loc, code, boolean_type_node, rhs0,
op1, !single_use0_p); op1, !single_use0_p);
} }
/* If that wasn't successful, try the second operand. */ /* If that wasn't successful, try the second operand. */
@ -427,15 +429,17 @@ forward_propagate_into_gimple_cond (gimple stmt)
return did_something; return did_something;
rhs1 = rhs_to_tree (TREE_TYPE (op0), def_stmt); rhs1 = rhs_to_tree (TREE_TYPE (op0), def_stmt);
tmp = combine_cond_expr_cond (code, boolean_type_node, op0, rhs1, tmp = combine_cond_expr_cond (loc, code, boolean_type_node, op0,
!single_use1_p); rhs1, !single_use1_p);
} }
/* If that wasn't successful either, try both operands. */ /* If that wasn't successful either, try both operands. */
if (tmp == NULL_TREE if (tmp == NULL_TREE
&& rhs0 != NULL_TREE && rhs0 != NULL_TREE
&& rhs1 != NULL_TREE) && rhs1 != NULL_TREE)
tmp = combine_cond_expr_cond (code, boolean_type_node, rhs0, tmp = combine_cond_expr_cond (loc, code, boolean_type_node, rhs0,
fold_convert (TREE_TYPE (rhs0), rhs1), fold_convert_loc (loc,
TREE_TYPE (rhs0),
rhs1),
!(single_use0_p && single_use1_p)); !(single_use0_p && single_use1_p));
} }
@ -487,6 +491,7 @@ static int
forward_propagate_into_cond (gimple_stmt_iterator *gsi_p) forward_propagate_into_cond (gimple_stmt_iterator *gsi_p)
{ {
gimple stmt = gsi_stmt (*gsi_p); gimple stmt = gsi_stmt (*gsi_p);
location_t loc = gimple_location (stmt);
int did_something = 0; int did_something = 0;
do { do {
@ -508,7 +513,8 @@ forward_propagate_into_cond (gimple_stmt_iterator *gsi_p)
{ {
tree op1 = TREE_OPERAND (cond, 1); tree op1 = TREE_OPERAND (cond, 1);
rhs0 = rhs_to_tree (TREE_TYPE (op1), def_stmt); rhs0 = rhs_to_tree (TREE_TYPE (op1), def_stmt);
tmp = combine_cond_expr_cond (TREE_CODE (cond), boolean_type_node, tmp = combine_cond_expr_cond (loc, TREE_CODE (cond),
boolean_type_node,
rhs0, op1, !single_use0_p); rhs0, op1, !single_use0_p);
} }
/* If that wasn't successful, try the second operand. */ /* If that wasn't successful, try the second operand. */
@ -522,16 +528,20 @@ forward_propagate_into_cond (gimple_stmt_iterator *gsi_p)
return did_something; return did_something;
rhs1 = rhs_to_tree (TREE_TYPE (op0), def_stmt); rhs1 = rhs_to_tree (TREE_TYPE (op0), def_stmt);
tmp = combine_cond_expr_cond (TREE_CODE (cond), boolean_type_node, tmp = combine_cond_expr_cond (loc, TREE_CODE (cond),
boolean_type_node,
op0, rhs1, !single_use1_p); op0, rhs1, !single_use1_p);
} }
/* If that wasn't successful either, try both operands. */ /* If that wasn't successful either, try both operands. */
if (tmp == NULL_TREE if (tmp == NULL_TREE
&& rhs0 != NULL_TREE && rhs0 != NULL_TREE
&& rhs1 != NULL_TREE) && rhs1 != NULL_TREE)
tmp = combine_cond_expr_cond (TREE_CODE (cond), boolean_type_node, tmp = combine_cond_expr_cond (loc, TREE_CODE (cond),
rhs0, fold_convert (TREE_TYPE (rhs0), boolean_type_node,
rhs1), rhs0,
fold_convert_loc (loc,
TREE_TYPE (rhs0),
rhs1),
!(single_use0_p && single_use1_p)); !(single_use0_p && single_use1_p));
} }
else if (TREE_CODE (cond) == SSA_NAME) else if (TREE_CODE (cond) == SSA_NAME)
@ -542,7 +552,7 @@ forward_propagate_into_cond (gimple_stmt_iterator *gsi_p)
return did_something; return did_something;
rhs0 = gimple_assign_rhs1 (def_stmt); rhs0 = gimple_assign_rhs1 (def_stmt);
tmp = combine_cond_expr_cond (NE_EXPR, boolean_type_node, rhs0, tmp = combine_cond_expr_cond (loc, NE_EXPR, boolean_type_node, rhs0,
build_int_cst (TREE_TYPE (rhs0), 0), build_int_cst (TREE_TYPE (rhs0), 0),
false); false);
} }
@ -1042,7 +1052,9 @@ forward_propagate_comparison (gimple stmt)
gimple_assign_rhs1 (stmt), gimple_assign_rhs1 (stmt),
gimple_assign_rhs2 (stmt)); gimple_assign_rhs2 (stmt));
tmp = combine_cond_expr_cond (code, TREE_TYPE (lhs), cond, cst, false); tmp = combine_cond_expr_cond (gimple_location (use_stmt),
code, TREE_TYPE (lhs),
cond, cst, false);
if (tmp == NULL_TREE) if (tmp == NULL_TREE)
return false; return false;
} }
@ -1214,7 +1226,8 @@ simplify_bitwise_and (gimple_stmt_iterator *gsi, gimple stmt)
} }
} }
res = fold_binary (BIT_AND_EXPR, TREE_TYPE (gimple_assign_lhs (stmt)), res = fold_binary_loc (gimple_location (stmt),
BIT_AND_EXPR, TREE_TYPE (gimple_assign_lhs (stmt)),
arg1, arg2); arg1, arg2);
if (res && is_gimple_min_invariant (res)) if (res && is_gimple_min_invariant (res))
{ {

View File

@ -392,7 +392,8 @@ ifcombine_ifandif (basic_block inner_cond_bb, basic_block outer_cond_bb)
enum tree_code code2 = gimple_cond_code (outer_cond); enum tree_code code2 = gimple_cond_code (outer_cond);
tree t; tree t;
if (!(t = combine_comparisons (TRUTH_ANDIF_EXPR, code1, code2, if (!(t = combine_comparisons (UNKNOWN_LOCATION,
TRUTH_ANDIF_EXPR, code1, code2,
boolean_type_node, boolean_type_node,
gimple_cond_lhs (outer_cond), gimple_cond_lhs (outer_cond),
gimple_cond_rhs (outer_cond)))) gimple_cond_rhs (outer_cond))))
@ -541,7 +542,8 @@ ifcombine_iforif (basic_block inner_cond_bb, basic_block outer_cond_bb)
enum tree_code code2 = gimple_cond_code (outer_cond); enum tree_code code2 = gimple_cond_code (outer_cond);
tree t; tree t;
if (!(t = combine_comparisons (TRUTH_ORIF_EXPR, code1, code2, if (!(t = combine_comparisons (UNKNOWN_LOCATION,
TRUTH_ORIF_EXPR, code1, code2,
boolean_type_node, boolean_type_node,
gimple_cond_lhs (outer_cond), gimple_cond_lhs (outer_cond),
gimple_cond_rhs (outer_cond)))) gimple_cond_rhs (outer_cond))))

View File

@ -552,6 +552,7 @@ build_arrays (gimple swtch)
gimple stmt; gimple stmt;
gimple_stmt_iterator gsi; gimple_stmt_iterator gsi;
int i; int i;
location_t loc = gimple_location (swtch);
gsi = gsi_for_stmt (swtch); gsi = gsi_for_stmt (swtch);
@ -559,9 +560,10 @@ build_arrays (gimple swtch)
tmp = create_tmp_var (TREE_TYPE (info.index_expr), "csti"); tmp = create_tmp_var (TREE_TYPE (info.index_expr), "csti");
add_referenced_var (tmp); add_referenced_var (tmp);
tidx = make_ssa_name (tmp, NULL); tidx = make_ssa_name (tmp, NULL);
sub = fold_build2 (MINUS_EXPR, TREE_TYPE (info.index_expr), info.index_expr, sub = fold_build2_loc (loc, MINUS_EXPR,
fold_convert (TREE_TYPE (info.index_expr), TREE_TYPE (info.index_expr), info.index_expr,
info.range_min)); fold_convert_loc (loc, TREE_TYPE (info.index_expr),
info.range_min));
sub = force_gimple_operand_gsi (&gsi, sub, sub = force_gimple_operand_gsi (&gsi, sub,
false, NULL, true, GSI_SAME_STMT); false, NULL, true, GSI_SAME_STMT);
stmt = gimple_build_assign (tidx, sub); stmt = gimple_build_assign (tidx, sub);
@ -684,6 +686,7 @@ gen_inbound_check (gimple swtch)
gimple_stmt_iterator gsi; gimple_stmt_iterator gsi;
basic_block bb0, bb1, bb2, bbf, bbd; basic_block bb0, bb1, bb2, bbf, bbd;
edge e01, e02, e21, e1d, e1f, e2f; edge e01, e02, e21, e1d, e1f, e2f;
location_t loc = gimple_location (swtch);
gcc_assert (info.default_values); gcc_assert (info.default_values);
bb0 = gimple_bb (swtch); bb0 = gimple_bb (swtch);
@ -700,14 +703,14 @@ gen_inbound_check (gimple swtch)
add_referenced_var (tmp_u_var); add_referenced_var (tmp_u_var);
tmp_u_1 = make_ssa_name (tmp_u_var, NULL); tmp_u_1 = make_ssa_name (tmp_u_var, NULL);
cast = fold_convert (utype, info.index_expr); cast = fold_convert_loc (loc, utype, info.index_expr);
cast_assign = gimple_build_assign (tmp_u_1, cast); cast_assign = gimple_build_assign (tmp_u_1, cast);
SSA_NAME_DEF_STMT (tmp_u_1) = cast_assign; SSA_NAME_DEF_STMT (tmp_u_1) = cast_assign;
gsi_insert_before (&gsi, cast_assign, GSI_SAME_STMT); gsi_insert_before (&gsi, cast_assign, GSI_SAME_STMT);
update_stmt (cast_assign); update_stmt (cast_assign);
ulb = fold_convert (utype, info.range_min); ulb = fold_convert_loc (loc, utype, info.range_min);
minus = fold_build2 (MINUS_EXPR, utype, tmp_u_1, ulb); minus = fold_build2_loc (loc, MINUS_EXPR, utype, tmp_u_1, ulb);
minus = force_gimple_operand_gsi (&gsi, minus, false, NULL, true, minus = force_gimple_operand_gsi (&gsi, minus, false, NULL, true,
GSI_SAME_STMT); GSI_SAME_STMT);
tmp_u_2 = make_ssa_name (tmp_u_var, NULL); tmp_u_2 = make_ssa_name (tmp_u_var, NULL);
@ -716,7 +719,7 @@ gen_inbound_check (gimple swtch)
gsi_insert_before (&gsi, minus_assign, GSI_SAME_STMT); gsi_insert_before (&gsi, minus_assign, GSI_SAME_STMT);
update_stmt (minus_assign); update_stmt (minus_assign);
bound = fold_convert (utype, info.range_size); bound = fold_convert_loc (loc, utype, info.range_size);
cond_stmt = gimple_build_cond (LE_EXPR, tmp_u_2, bound, NULL_TREE, NULL_TREE); cond_stmt = gimple_build_cond (LE_EXPR, tmp_u_2, bound, NULL_TREE, NULL_TREE);
gsi_insert_before (&gsi, cond_stmt, GSI_SAME_STMT); gsi_insert_before (&gsi, cond_stmt, GSI_SAME_STMT);
update_stmt (cond_stmt); update_stmt (cond_stmt);

View File

@ -8537,7 +8537,8 @@ build_call_valist (tree return_type, tree fn, int nargs, va_list args)
which are specified as a tree array ARGS. */ which are specified as a tree array ARGS. */
tree tree
build_call_array (tree return_type, tree fn, int nargs, const tree *args) build_call_array_loc (location_t loc, tree return_type, tree fn,
int nargs, const tree *args)
{ {
tree t; tree t;
int i; int i;
@ -8549,6 +8550,7 @@ build_call_array (tree return_type, tree fn, int nargs, const tree *args)
for (i = 0; i < nargs; i++) for (i = 0; i < nargs; i++)
CALL_EXPR_ARG (t, i) = args[i]; CALL_EXPR_ARG (t, i) = args[i];
process_call_operands (t); process_call_operands (t);
SET_EXPR_LOCATION (t, loc);
return t; return t;
} }

View File

@ -3838,7 +3838,9 @@ extern tree build_vl_exp_stat (enum tree_code, int MEM_STAT_DECL);
extern tree build_call_list (tree, tree, tree); extern tree build_call_list (tree, tree, tree);
extern tree build_call_nary (tree, tree, int, ...); extern tree build_call_nary (tree, tree, int, ...);
extern tree build_call_valist (tree, tree, int, va_list); extern tree build_call_valist (tree, tree, int, va_list);
extern tree build_call_array (tree, tree, int, const tree *); #define build_call_array(T1,T2,N,T3)\
build_call_array_loc (UNKNOWN_LOCATION, T1, T2, N, T3)
extern tree build_call_array_loc (location_t, tree, tree, int, const tree *);
extern tree build_call_vec (tree, tree, VEC(tree,gc) *); extern tree build_call_vec (tree, tree, VEC(tree,gc) *);
/* Construct various nodes representing data types. */ /* Construct various nodes representing data types. */
@ -4166,7 +4168,8 @@ extern enum machine_mode mode_for_size_tree (const_tree, enum mode_class, int);
/* Return an expr equal to X but certainly not valid as an lvalue. */ /* Return an expr equal to X but certainly not valid as an lvalue. */
extern tree non_lvalue (tree); #define non_lvalue(T) non_lvalue_loc (UNKNOWN_LOCATION, T)
extern tree non_lvalue_loc (location_t, tree);
extern tree convert (tree, tree); extern tree convert (tree, tree);
extern unsigned int expr_align (const_tree); extern unsigned int expr_align (const_tree);
@ -4199,16 +4202,22 @@ extern GTY(()) tree sizetype_tab[(int) TYPE_KIND_LAST];
#define sbitsizetype sizetype_tab[(int) SBITSIZETYPE] #define sbitsizetype sizetype_tab[(int) SBITSIZETYPE]
extern tree size_int_kind (HOST_WIDE_INT, enum size_type_kind); extern tree size_int_kind (HOST_WIDE_INT, enum size_type_kind);
extern tree size_binop (enum tree_code, tree, tree); #define size_binop(CODE,T1,T2)\
extern tree size_diffop (tree, tree); size_binop_loc (UNKNOWN_LOCATION, CODE, T1, T2)
extern tree size_binop_loc (location_t, enum tree_code, tree, tree);
#define size_diffop(T1,T2)\
size_diffop_loc (UNKNOWN_LOCATION, T1, T2)
extern tree size_diffop_loc (location_t, tree, tree);
#define size_int(L) size_int_kind (L, SIZETYPE) #define size_int(L) size_int_kind (L, SIZETYPE)
#define ssize_int(L) size_int_kind (L, SSIZETYPE) #define ssize_int(L) size_int_kind (L, SSIZETYPE)
#define bitsize_int(L) size_int_kind (L, BITSIZETYPE) #define bitsize_int(L) size_int_kind (L, BITSIZETYPE)
#define sbitsize_int(L) size_int_kind (L, SBITSIZETYPE) #define sbitsize_int(L) size_int_kind (L, SBITSIZETYPE)
extern tree round_up (tree, int); #define round_up(T,N) round_up_loc (UNKNOWN_LOCATION, T, N)
extern tree round_down (tree, int); extern tree round_up_loc (location_t, tree, int);
#define round_down(T,N) round_down_loc (UNKNOWN_LOCATION, T, N)
extern tree round_down_loc (location_t, tree, int);
extern tree get_pending_sizes (void); extern tree get_pending_sizes (void);
extern void put_pending_size (tree); extern void put_pending_size (tree);
extern void put_pending_sizes (tree); extern void put_pending_sizes (tree);
@ -4649,27 +4658,53 @@ extern tree native_interpret_expr (tree, const unsigned char *, int);
subexpressions are not changed. */ subexpressions are not changed. */
extern tree fold (tree); extern tree fold (tree);
extern tree fold_unary (enum tree_code, tree, tree); #define fold_unary(CODE,T1,T2)\
extern tree fold_unary_ignore_overflow (enum tree_code, tree, tree); fold_unary_loc (UNKNOWN_LOCATION, CODE, T1, T2)
extern tree fold_binary (enum tree_code, tree, tree, tree); extern tree fold_unary_loc (location_t, enum tree_code, tree, tree);
extern tree fold_ternary (enum tree_code, tree, tree, tree, tree); #define fold_unary_ignore_overflow(CODE,T1,T2)\
extern tree fold_build1_stat (enum tree_code, tree, tree MEM_STAT_DECL); fold_unary_ignore_overflow_loc (UNKNOWN_LOCATION, CODE, T1, T2)
#define fold_build1(c,t1,t2) fold_build1_stat (c, t1, t2 MEM_STAT_INFO) extern tree fold_unary_ignore_overflow_loc (location_t, enum tree_code, tree, tree);
extern tree fold_build2_stat (enum tree_code, tree, tree, tree MEM_STAT_DECL); #define fold_binary(CODE,T1,T2,T3)\
#define fold_build2(c,t1,t2,t3) fold_build2_stat (c, t1, t2, t3 MEM_STAT_INFO) fold_binary_loc (UNKNOWN_LOCATION, CODE, T1, T2, T3)
extern tree fold_build3_stat (enum tree_code, tree, tree, tree, tree MEM_STAT_DECL); extern tree fold_binary_loc (location_t, enum tree_code, tree, tree, tree);
#define fold_build3(c,t1,t2,t3,t4) fold_build3_stat (c, t1, t2, t3, t4 MEM_STAT_INFO) #define fold_ternary(CODE,T1,T2,T3,T4)\
extern tree fold_build1_initializer (enum tree_code, tree, tree); fold_ternary_loc (UNKNOWN_LOCATION, CODE, T1, T2, T3, T4)
extern tree fold_build2_initializer (enum tree_code, tree, tree, tree); extern tree fold_ternary_loc (location_t, enum tree_code, tree, tree, tree, tree);
extern tree fold_build3_initializer (enum tree_code, tree, tree, tree, tree); #define fold_build1(c,t1,t2)\
extern tree fold_build_call_array (tree, tree, int, tree *); fold_build1_stat_loc (UNKNOWN_LOCATION, c, t1, t2 MEM_STAT_INFO)
extern tree fold_build_call_array_initializer (tree, tree, int, tree *); #define fold_build1_loc(l,c,t1,t2)\
fold_build1_stat_loc (l, c, t1, t2 MEM_STAT_INFO)
extern tree fold_build1_stat_loc (location_t, enum tree_code, tree,
tree MEM_STAT_DECL);
#define fold_build2(c,t1,t2,t3)\
fold_build2_stat_loc (UNKNOWN_LOCATION, c, t1, t2, t3 MEM_STAT_INFO)
#define fold_build2_loc(l,c,t1,t2,t3)\
fold_build2_stat_loc (l, c, t1, t2, t3 MEM_STAT_INFO)
extern tree fold_build2_stat_loc (location_t, enum tree_code, tree, tree,
tree MEM_STAT_DECL);
#define fold_build3(c,t1,t2,t3,t4)\
fold_build3_stat_loc (UNKNOWN_LOCATION, c, t1, t2, t3, t4 MEM_STAT_INFO)
#define fold_build3_loc(l,c,t1,t2,t3,t4)\
fold_build3_stat_loc (l, c, t1, t2, t3, t4 MEM_STAT_INFO)
extern tree fold_build3_stat_loc (location_t, enum tree_code, tree, tree, tree,
tree MEM_STAT_DECL);
extern tree fold_build1_initializer_loc (location_t, enum tree_code, tree, tree);
extern tree fold_build2_initializer_loc (location_t, enum tree_code, tree, tree, tree);
extern tree fold_build3_initializer_loc (location_t, enum tree_code, tree, tree, tree, tree);
#define fold_build_call_array(T1,T2,N,T4)\
fold_build_call_array_loc (UNKNOWN_LOCATION, T1, T2, N, T4)
extern tree fold_build_call_array_loc (location_t, tree, tree, int, tree *);
#define fold_build_call_array_initializer(T1,T2,N,T4)\
fold_build_call_array_initializer_loc (UNKNOWN_LOCATION, T1, T2, N, T4)
extern tree fold_build_call_array_initializer_loc (location_t, tree, tree, int, tree *);
extern bool fold_convertible_p (const_tree, const_tree); extern bool fold_convertible_p (const_tree, const_tree);
extern tree fold_convert (tree, tree); #define fold_convert(T1,T2)\
extern tree fold_single_bit_test (enum tree_code, tree, tree, tree); fold_convert_loc(UNKNOWN_LOCATION, T1, T2)
extern tree fold_convert_loc (location_t, tree, tree);
extern tree fold_single_bit_test (location_t, enum tree_code, tree, tree, tree);
extern tree fold_ignored_result (tree); extern tree fold_ignored_result (tree);
extern tree fold_abs_const (tree, tree); extern tree fold_abs_const (tree, tree);
extern tree fold_indirect_ref_1 (tree, tree); extern tree fold_indirect_ref_1 (location_t, tree, tree);
extern void fold_defer_overflow_warnings (void); extern void fold_defer_overflow_warnings (void);
extern void fold_undefer_overflow_warnings (bool, const_gimple, int); extern void fold_undefer_overflow_warnings (bool, const_gimple, int);
extern void fold_undefer_and_ignore_overflow_warnings (void); extern void fold_undefer_and_ignore_overflow_warnings (void);
@ -4721,20 +4756,34 @@ enum operand_equal_flag
extern int operand_equal_p (const_tree, const_tree, unsigned int); extern int operand_equal_p (const_tree, const_tree, unsigned int);
extern int multiple_of_p (tree, const_tree, const_tree); extern int multiple_of_p (tree, const_tree, const_tree);
extern tree omit_one_operand (tree, tree, tree); #define omit_one_operand(T1,T2,T3)\
extern tree omit_two_operands (tree, tree, tree, tree); omit_one_operand_loc (UNKNOWN_LOCATION, T1, T2, T3)
extern tree invert_truthvalue (tree); extern tree omit_one_operand_loc (location_t, tree, tree, tree);
extern tree fold_truth_not_expr (tree); #define omit_two_operands(T1,T2,T3,T4)\
omit_two_operands_loc (UNKNOWN_LOCATION, T1, T2, T3, T4)
extern tree omit_two_operands_loc (location_t, tree, tree, tree, tree);
#define invert_truthvalue(T)\
invert_truthvalue_loc(UNKNOWN_LOCATION, T)
extern tree invert_truthvalue_loc (location_t, tree);
extern tree fold_truth_not_expr (location_t, tree);
extern tree fold_unary_to_constant (enum tree_code, tree, tree); extern tree fold_unary_to_constant (enum tree_code, tree, tree);
extern tree fold_binary_to_constant (enum tree_code, tree, tree, tree); extern tree fold_binary_to_constant (enum tree_code, tree, tree, tree);
extern tree fold_read_from_constant_string (tree); extern tree fold_read_from_constant_string (tree);
extern tree int_const_binop (enum tree_code, const_tree, const_tree, int); extern tree int_const_binop (enum tree_code, const_tree, const_tree, int);
extern tree build_fold_addr_expr (tree); #define build_fold_addr_expr(T)\
build_fold_addr_expr_loc (UNKNOWN_LOCATION, (T))
extern tree build_fold_addr_expr_loc (location_t, tree);
#define build_fold_addr_expr_with_type(T,TYPE)\
build_fold_addr_expr_with_type_loc (UNKNOWN_LOCATION, (T), TYPE)
extern tree build_fold_addr_expr_with_type_loc (location_t, tree, tree);
extern tree fold_build_cleanup_point_expr (tree type, tree expr); extern tree fold_build_cleanup_point_expr (tree type, tree expr);
extern tree fold_strip_sign_ops (tree); extern tree fold_strip_sign_ops (tree);
extern tree build_fold_addr_expr_with_type (tree, tree); #define build_fold_indirect_ref(T)\
extern tree build_fold_indirect_ref (tree); build_fold_indirect_ref_loc (UNKNOWN_LOCATION, T)
extern tree fold_indirect_ref (tree); extern tree build_fold_indirect_ref_loc (location_t, tree);
#define fold_indirect_ref(T)\
fold_indirect_ref_loc (UNKNOWN_LOCATION, T)
extern tree fold_indirect_ref_loc (location_t, tree);
extern tree constant_boolean_node (int, tree); extern tree constant_boolean_node (int, tree);
extern tree div_if_zero_remainder (enum tree_code, const_tree, const_tree); extern tree div_if_zero_remainder (enum tree_code, const_tree, const_tree);
@ -4759,7 +4808,7 @@ extern bool tree_call_nonnegative_warnv_p (tree, tree, tree, tree, bool *);
extern bool tree_expr_nonzero_warnv_p (tree, bool *); extern bool tree_expr_nonzero_warnv_p (tree, bool *);
extern bool fold_real_zero_addition_p (const_tree, const_tree, int); extern bool fold_real_zero_addition_p (const_tree, const_tree, int);
extern tree combine_comparisons (enum tree_code, enum tree_code, extern tree combine_comparisons (location_t, enum tree_code, enum tree_code,
enum tree_code, tree, tree, tree); enum tree_code, tree, tree, tree);
extern void debug_fold_checksum (const_tree); extern void debug_fold_checksum (const_tree);
@ -4775,21 +4824,23 @@ truth_value_p (enum tree_code code)
/* In builtins.c */ /* In builtins.c */
extern tree fold_call_expr (tree, bool); extern tree fold_call_expr (location_t, tree, bool);
extern tree fold_builtin_fputs (tree, tree, bool, bool, tree); extern tree fold_builtin_fputs (location_t, tree, tree, bool, bool, tree);
extern tree fold_builtin_strcpy (tree, tree, tree, tree); extern tree fold_builtin_strcpy (location_t, tree, tree, tree, tree);
extern tree fold_builtin_strncpy (tree, tree, tree, tree, tree); extern tree fold_builtin_strncpy (location_t, tree, tree, tree, tree, tree);
extern tree fold_builtin_memory_chk (tree, tree, tree, tree, tree, tree, bool, extern tree fold_builtin_memory_chk (location_t, tree, tree, tree, tree, tree, tree, bool,
enum built_in_function); enum built_in_function);
extern tree fold_builtin_stxcpy_chk (tree, tree, tree, tree, tree, bool, extern tree fold_builtin_stxcpy_chk (location_t, tree, tree, tree, tree, tree, bool,
enum built_in_function); enum built_in_function);
extern tree fold_builtin_strncpy_chk (tree, tree, tree, tree, tree); extern tree fold_builtin_strncpy_chk (location_t, tree, tree, tree, tree, tree);
extern tree fold_builtin_snprintf_chk (tree, tree, enum built_in_function); extern tree fold_builtin_snprintf_chk (location_t, tree, tree, enum built_in_function);
extern bool fold_builtin_next_arg (tree, bool); extern bool fold_builtin_next_arg (tree, bool);
extern enum built_in_function builtin_mathfn_code (const_tree); extern enum built_in_function builtin_mathfn_code (const_tree);
extern tree build_function_call_expr (tree, tree); extern tree build_function_call_expr (location_t, tree, tree);
extern tree fold_builtin_call_array (tree, tree, int, tree *); extern tree fold_builtin_call_array (location_t, tree, tree, int, tree *);
extern tree build_call_expr (tree, int, ...); #define build_call_expr(...)\
build_call_expr_loc (UNKNOWN_LOCATION, __VA_ARGS__)
extern tree build_call_expr_loc (location_t, tree, int, ...);
extern tree mathfn_built_in (tree, enum built_in_function fn); extern tree mathfn_built_in (tree, enum built_in_function fn);
extern tree c_strlen (tree, int); extern tree c_strlen (tree, int);
extern tree std_gimplify_va_arg_expr (tree, tree, gimple_seq *, gimple_seq *); extern tree std_gimplify_va_arg_expr (tree, tree, gimple_seq *, gimple_seq *);
@ -4804,7 +4855,7 @@ extern int get_object_alignment (tree, unsigned int, unsigned int);
extern tree fold_call_stmt (gimple, bool); extern tree fold_call_stmt (gimple, bool);
extern tree gimple_fold_builtin_snprintf_chk (gimple, tree, enum built_in_function); extern tree gimple_fold_builtin_snprintf_chk (gimple, tree, enum built_in_function);
extern tree make_range (tree, int *, tree *, tree *, bool *); extern tree make_range (tree, int *, tree *, tree *, bool *);
extern tree build_range_check (tree, tree, int, tree, tree); extern tree build_range_check (location_t, tree, tree, int, tree, tree);
extern bool merge_ranges (int *, tree *, tree *, int, tree, tree, int, extern bool merge_ranges (int *, tree *, tree *, int, tree, tree, int,
tree, tree); tree, tree);

View File

@ -445,7 +445,7 @@ emutls_common_1 (void **loc, void *xstmts)
args = tree_cons (NULL, x, args); args = tree_cons (NULL, x, args);
x = built_in_decls[BUILT_IN_EMUTLS_REGISTER_COMMON]; x = built_in_decls[BUILT_IN_EMUTLS_REGISTER_COMMON];
x = build_function_call_expr (x, args); x = build_function_call_expr (UNKNOWN_LOCATION, x, args);
append_to_statement_list (x, pstmts); append_to_statement_list (x, pstmts);
return 1; return 1;