aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vrp.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2019-03-08 11:46:39 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2019-03-08 11:46:39 +0100
commit1db01ff96aa5ce5c4ad78313d342cf70f923b40c (patch)
treefae09df731b30ee508d5a37f95a71ca30d15912d /gcc/tree-vrp.c
parent94ec37a909697bbf29db73278c77621ccdf60693 (diff)
downloadgcc-1db01ff96aa5ce5c4ad78313d342cf70f923b40c.zip
gcc-1db01ff96aa5ce5c4ad78313d342cf70f923b40c.tar.gz
gcc-1db01ff96aa5ce5c4ad78313d342cf70f923b40c.tar.bz2
re PR tree-optimization/89550 (Spurious array-bounds warning when using __PRETTY_FUNCTION__ as a string_view)
PR tree-optimization/89550 * builtins.c (c_strlen): Only set TREE_NO_WARNING if warning_at returned true. Formatting fixes. (expand_builtin_strnlen): Formatting fixes. * tree-vrp.c (vrp_prop::check_mem_ref): Only set TREE_NO_WARNING if warning_at returned true. * tree-cfg.c (pass_warn_function_return::execute): Likewise. c-family/ * c-common.c (c_common_truthvalue_conversion): Only set TREE_NO_WARNING if warning_at returned true. * c-warn.c (overflow_warning, warn_logical_operator): Likewise. c/ * c-decl.c (finish_function): Only set TREE_NO_WARNING if warning_at returned true. (c_write_global_declarations_1): Only set TREE_NO_WARNING if pedwarn or warning returned true. cp/ * semantics.c (maybe_convert_cond): Only set TREE_NO_WARNING if warning_at returned true. * decl2.c (c_parse_final_cleanups): Likewise. * typeck.c (convert_for_assignment): Likewise. * decl.c (finish_function): Likewise. From-SVN: r269485
Diffstat (limited to 'gcc/tree-vrp.c')
-rw-r--r--gcc/tree-vrp.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index bde0751..bf1d947 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -4749,7 +4749,8 @@ vrp_prop::check_mem_ref (location_t location, tree ref,
if (warned && DECL_P (arg))
inform (DECL_SOURCE_LOCATION (arg), "while referencing %qD", arg);
- TREE_NO_WARNING (ref) = 1;
+ if (warned)
+ TREE_NO_WARNING (ref) = 1;
return;
}
@@ -4762,11 +4763,10 @@ vrp_prop::check_mem_ref (location_t location, tree ref,
{
HOST_WIDE_INT tmpidx = extrema[i].to_shwi () / eltsize.to_shwi ();
- warning_at (location, OPT_Warray_bounds,
- "intermediate array offset %wi is outside array bounds "
- "of %qT",
- tmpidx, reftype);
- TREE_NO_WARNING (ref) = 1;
+ if (warning_at (location, OPT_Warray_bounds,
+ "intermediate array offset %wi is outside array bounds "
+ "of %qT", tmpidx, reftype))
+ TREE_NO_WARNING (ref) = 1;
}
}