From 8a45b051bf874c645b2b0316ea3b542be4b594db Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Wed, 1 Aug 2018 23:39:35 +0000 Subject: PR tree-optimization/86650 - -Warray-bounds missing inlining context gcc/c/ChangeLog: PR tree-optimization/86650 * c-objc-common.c (c_tree_printer): Move usage of EXPR_LOCATION (t) and TREE_BLOCK (t) from within percent_K_format to this callsite. gcc/c-family/ChangeLog: PR tree-optimization/86650 * c-family/c-format.c (gcc_tdiag_char_table): Update comment for "%G". (gcc_cdiag_char_table, gcc_cxxdiag_char_table): Same. (init_dynamic_diag_info): Update from "gcall *" to "gimple *". * c-format.h (T89_G): Update to be "gimple *" rather than "gcall *". (local_gcall_ptr_node): Rename... (local_gimple_ptr_node): ...to this. gcc/cp/ChangeLog: PR tree-optimization/86650 * error.c (cp_printer): Move usage of EXPR_LOCATION (t) and TREE_BLOCK (t) from within percent_K_format to this callsite. gcc/ChangeLog: PR tree-optimization/86650 * gimple-pretty-print.c (percent_G_format): Accept a "gimple *" rather than a "gcall *". Directly pass the data of interest to percent_K_format, rather than building a temporary CALL_EXPR to hold it. * gimple-fold.c (gimple_fold_builtin_strncpy): Adjust. (gimple_fold_builtin_strncat): Adjust. * gimple-ssa-warn-restrict.h (check_bounds_or_overlap): Replace gcall* argument with gimple*. * gimple-ssa-warn-restrict.c (check_call): Same. (wrestrict_dom_walker::before_dom_children): Same. (builtin_access::builtin_access): Same. (check_bounds_or_overlap): Same (maybe_diag_overlap): Same. (maybe_diag_offset_bounds): Same. * tree-diagnostic.c (default_tree_printer): Move usage of EXPR_LOCATION (t) and TREE_BLOCK (t) from within percent_K_format to this callsite. * tree-pretty-print.c (percent_K_format): Add argument. * tree-pretty-print.h: Add argument. * tree-ssa-ccp.c (pass_post_ipa_warn::execute): Adjust. * tree-ssa-strlen.c (maybe_diag_stxncpy_trunc): Adjust. (maybe_diag_stxncpy_trunc): Same. (handle_builtin_stxncpy): Same. (handle_builtin_strcat): Same. gcc/testsuite/ChangeLog: PR tree-optimization/86650 * gcc.dg/format/gcc_diag-10.c: Adjust. From-SVN: r263239 --- gcc/gimple-ssa-warn-restrict.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'gcc/gimple-ssa-warn-restrict.c') diff --git a/gcc/gimple-ssa-warn-restrict.c b/gcc/gimple-ssa-warn-restrict.c index 7dedb24..01503d6 100644 --- a/gcc/gimple-ssa-warn-restrict.c +++ b/gcc/gimple-ssa-warn-restrict.c @@ -88,7 +88,7 @@ class wrestrict_dom_walker : public dom_walker bool handle_gimple_call (gimple_stmt_iterator *); private: - void check_call (gcall *); + void check_call (gimple *); }; edge @@ -102,8 +102,7 @@ wrestrict_dom_walker::before_dom_children (basic_block bb) if (!is_gimple_call (stmt)) continue; - if (gcall *call = as_a (stmt)) - check_call (call); + check_call (stmt); } return NULL; @@ -192,7 +191,7 @@ class builtin_access return detect_overlap != &builtin_access::generic_overlap; } - builtin_access (gcall *, builtin_memref &, builtin_memref &); + builtin_access (gimple *, builtin_memref &, builtin_memref &); /* Entry point to determine overlap. */ bool overlap (); @@ -563,7 +562,7 @@ builtin_memref::offset_out_of_bounds (int strict, offset_int ooboff[2]) const /* Create an association between the memory references DST and SRC for access by a call EXPR to a memory or string built-in funtion. */ -builtin_access::builtin_access (gcall *call, builtin_memref &dst, +builtin_access::builtin_access (gimple *call, builtin_memref &dst, builtin_memref &src) : dstref (&dst), srcref (&src), sizrange (), ovloff (), ovlsiz (), dstoff (), srcoff (), dstsiz (), srcsiz () @@ -1324,7 +1323,7 @@ builtin_access::overlap () Return true when one has been detected, false otherwise. */ static bool -maybe_diag_overlap (location_t loc, gcall *call, builtin_access &acs) +maybe_diag_overlap (location_t loc, gimple *call, builtin_access &acs) { if (!acs.overlap ()) return false; @@ -1577,7 +1576,7 @@ maybe_diag_overlap (location_t loc, gcall *call, builtin_access &acs) has been issued. */ static bool -maybe_diag_offset_bounds (location_t loc, gcall *call, tree func, int strict, +maybe_diag_offset_bounds (location_t loc, gimple *call, tree func, int strict, tree expr, const builtin_memref &ref) { if (!warn_array_bounds) @@ -1722,7 +1721,7 @@ maybe_diag_offset_bounds (location_t loc, gcall *call, tree func, int strict, if/when appropriate. */ void -wrestrict_dom_walker::check_call (gcall *call) +wrestrict_dom_walker::check_call (gimple *call) { /* Avoid checking the call if it has already been diagnosed for some reason. */ @@ -1822,7 +1821,7 @@ wrestrict_dom_walker::check_call (gcall *call) detected and diagnosed, true otherwise. */ bool -check_bounds_or_overlap (gcall *call, tree dst, tree src, tree dstsize, +check_bounds_or_overlap (gimple *call, tree dst, tree src, tree dstsize, tree srcsize, bool bounds_only /* = false */) { location_t loc = gimple_nonartificial_location (call); -- cgit v1.1