This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] beat location sense into fold (PR/40435)


Hi folks.

Sorry it took so long, but this was far more work than I had
anticipated.

The following incredibly boring yet painfully tedious patch adds
location information to fold_{unary,binary,etc} and fold_build[123]--
basically all of fold-const.c and supporting machinery.

[After seeing the magnitude of my changes, I chickened out of converting
all uses of fold_convert() and size_binop().  Instead, I made location
aware versions (fold_convert_loc() and size_binop_op()), and defined
macros for fold_convert() and size_binop() that just pass
input_location.  So only the relevant calls to fold_convert/size_binop
were changed.]

The reason for this patch was to fix PR/40435 which I caused after the
diagnostics merge.  The problem in the PR was that warnings in an
inlined function were being attributed to the caller, not the callee,
because during tree inlining we were getting the location from the
caller.

This patch fixes gcc.dg/Wshadow-3.c and gcc.dg/pr36902.c without
introducing any regressions.

It has been tested on x86-64 Linux with all languages enabled, including
obj-c++ and Ada.  I have also built cc1 for alpha, ia64, mep, mips, pa,
rs6000, sh, sparc, stormy16, and xtensa.

The patch is over a megabyte long, and I'm sure no one wants to see it,
let alone have it in their inbox.  It is available in the link below for
review.  I can post it on request.

http://quesejoda.com/patches/fold-locations-patch

OK for mainline?

	* tree-vrp.c, tree-ssa-loop-im.c, tree-complex.c,
	tree-ssa-loop-niter.c, tree-loop-distribution.c,
	tree-ssa-loop-manip.c, tree.c, ipa-cp.c, tree-scalar-evolution.c,
	builtins.c, fold-const.c, omp-low.c, tree-chrec.c, tree-ssa-sccvn.c,
	cgraphunit.c, tree-vect-loop-manip.c, tree-ssa-ccp.c,
	tree-ssa-loop-ivopts.c, tree-call-cdce.c, tree-ssa-math-opts.c,
	tree-ssa-dom.c, gimple-low.c, expr.c, tree-ssa-loop-ivcanon.c,
	predict.c, tree-parloops.c, tree-ssa-address.c, tree-ssa-ifcombine.c,
	c-pretty-print.c, function.c,
	matrix-reorg.c, c-decl.c, stor-layout.c, tree-if-conv.c,
	tree-vect-loop.c, tree-data-ref.c, tree-affine.c,
	tree-vect-data-refs.c, c-typeck.c, gimplify.c, tree-ssa-phiopt.c,
	calls.c, expmed.c, coverage.c, emit-rtl.c, tree-ssa-pre.c, tree-sra.c,
	tree-predcom.c, tree-mudflap.c, lambda.h, tree-ssa-copy.c,
	tree-ssa-forwprop.c, c-convert.c, c-omp.c, varasm.c, lambda-code.c,
	tree-ssa-loop-prefetch.c, tree-vect-stmts.c, tree-inline.c,
	tree-object-size.c, c-common.c, c-common.h, gimple.c,
	tree-ssa-structalias.c, tree-switch-conversion.c, gimple.h,
	tree-cfg.c, ipa-struct-reorg.c, c-parser.c, tree-ssa-reassoc.c,
	config/alpha/alpha.c, config/ia64/ia64.c, config/mep/mep.c,
	config/mips/mips.c, config/pa/pa.c, config/rs6000/rs6000*.c,
	config/sh/sh.c, config/sparc/sparc.c, config/stormy16/stormy16.c,
	config/xtensa/xtensa.c, config/i386/i386.c, stmt.c,
	tree-ssa-threadedge.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.
	* fold-const.c (fold_convert): Rename to fold_convert_loc.
	(size_binop): Rename to size_binop_loc.
java/
	* typeck.c, class.c, resource.c, except.c, builtins.c, expr.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.
ada/
	* gcc-interface/utils.c, cc-interface/cuintp.c, cc-interface/decl.c,
	gcc-interface/utils2.c, gcc-interface/trans.c, gcc-interface/misc.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-common.c, trans-openmp.c,
	trans-const.c, trans-stmt.c, trans.c, trans-types.c, trans.h,
	f95-lang.c, trans-io.c, trans-decl.c, convert.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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]