diff options
author | Manuel López-Ibáñez <manu@gcc.gnu.org> | 2009-03-27 05:52:52 -0700 |
---|---|---|
committer | H.J. Lu <hjl@gcc.gnu.org> | 2009-03-27 05:52:52 -0700 |
commit | a5f805df5860bd185c77261deaa48049485bfa4e (patch) | |
tree | a838c5940ee7e4cdb7c09c0bf3ae71d1c2c5d538 /gcc/builtins.c | |
parent | 9fd1d8548908e5089281e45770e5c5533fd94424 (diff) | |
download | gcc-a5f805df5860bd185c77261deaa48049485bfa4e.zip gcc-a5f805df5860bd185c77261deaa48049485bfa4e.tar.gz gcc-a5f805df5860bd185c77261deaa48049485bfa4e.tar.bz2 |
re PR c++/35652 (offset warning should be given in the front-end)
gcc/
2009-03-27 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR c++/35652
* builtins.h (c_strlen): Do not warn here.
* c-typeck.c (build_binary_op): Adjust calls to pointer_int_sum.
* c-common.c (pointer_int_sum): Take an explicit location.
Warn about offsets out of bounds.
* c-common.h (pointer_int_sum): Adjust declaration.
gcc/cp/
2009-03-27 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR c++/35652
* typeck.c (cp_pointer_sum): Adjust call to pointer_int_sum.
gcc/testsuite/
2009-03-27 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR c++/35652
* gcc.dg/pr35652.C: New.
* g++.dg/warn/pr35652.C: New.
* gcc.dg/format/plus-1.c: Adjust message.
From-SVN: r145102
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c index cc9d93e..929ea90 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -469,16 +469,13 @@ c_strlen (tree src, int only_value) else offset = tree_low_cst (offset_node, 0); - /* If the offset is known to be out of bounds, warn, and call strlen at - runtime. */ + /* If the offset is known to be out of bounds, the front-end should + have warned already. We call strlen at runtime. + + ??? Perhaps we should turn this into an assert and force + front-ends to define offsets whtin boundaries. */ if (offset < 0 || offset > max) { - /* Suppress multiple warnings for propagated constant strings. */ - if (! TREE_NO_WARNING (src)) - { - warning (0, "offset outside bounds of constant string"); - TREE_NO_WARNING (src) = 1; - } return NULL_TREE; } |