aboutsummaryrefslogtreecommitdiff
path: root/gcc/builtins.c
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2018-01-15 06:15:09 +0000
committerJeff Law <law@gcc.gnu.org>2018-01-14 23:15:09 -0700
commite0676e2e718a28b2eeb1ef483653edd3b026a470 (patch)
tree8117ca4de8a5784615f5ca706e5dc3c2b6b10004 /gcc/builtins.c
parent5804f6271247b02199abdd62a89c0c2bf807b656 (diff)
downloadgcc-e0676e2e718a28b2eeb1ef483653edd3b026a470.zip
gcc-e0676e2e718a28b2eeb1ef483653edd3b026a470.tar.gz
gcc-e0676e2e718a28b2eeb1ef483653edd3b026a470.tar.bz2
re PR other/83508 ([arm] c-c++-common/Wrestrict.c fails since r255836)
PR other/83508 * builtins.c (check_access): Avoid warning when the no-warning bit is set. PR other/83508 * gcc.dg/Wstringop-overflow-2.c: New test. From-SVN: r256683
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r--gcc/builtins.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c
index a0d0a10..d9f1e47 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -3154,6 +3154,9 @@ check_access (tree exp, tree, tree, tree dstwrite,
|| (tree_fits_uhwi_p (dstwrite)
&& tree_int_cst_lt (dstwrite, range[0]))))
{
+ if (TREE_NO_WARNING (exp))
+ return false;
+
location_t loc = tree_nonartificial_location (exp);
loc = expansion_point_location_if_in_system_header (loc);
@@ -3213,6 +3216,9 @@ check_access (tree exp, tree, tree, tree dstwrite,
if (tree_int_cst_lt (maxobjsize, range[0]))
{
+ if (TREE_NO_WARNING (exp))
+ return false;
+
/* Warn about crazy big sizes first since that's more
likely to be meaningful than saying that the bound
is greater than the object size if both are big. */
@@ -3234,6 +3240,9 @@ check_access (tree exp, tree, tree, tree dstwrite,
if (dstsize != maxobjsize && tree_int_cst_lt (dstsize, range[0]))
{
+ if (TREE_NO_WARNING (exp))
+ return false;
+
if (tree_int_cst_equal (range[0], range[1]))
warning_at (loc, opt,
"%K%qD specified bound %E "
@@ -3257,6 +3266,9 @@ check_access (tree exp, tree, tree, tree dstwrite,
&& dstwrite && range[0]
&& tree_int_cst_lt (slen, range[0]))
{
+ if (TREE_NO_WARNING (exp))
+ return false;
+
location_t loc = tree_nonartificial_location (exp);
if (tree_int_cst_equal (range[0], range[1]))