aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/typeck.c
diff options
context:
space:
mode:
authorSimon Baldwin <simonb@google.com>2008-05-02 20:01:31 +0000
committerSimon Baldwin <simonb@gcc.gnu.org>2008-05-02 20:01:31 +0000
commite4d355154880463416ba21be979aa77654d727a0 (patch)
tree7a9abc71059af57af9a976cfa19589fee9e462be /gcc/cp/typeck.c
parentbb1418c1b43a95548515bffb8d4a54a173f2a49d (diff)
downloadgcc-e4d355154880463416ba21be979aa77654d727a0.zip
gcc-e4d355154880463416ba21be979aa77654d727a0.tar.gz
gcc-e4d355154880463416ba21be979aa77654d727a0.tar.bz2
Rolled back the following changes made in revision 134865:
* c-common.h (warn_array_subscript_range): New function. * c-common.c (warn_array_subscript_range): Ditto. * tree-vrp.c (check_array_ref): Corrected code to agree with comment, ignoring only arrays of size 0 or size 1. * c-typeck.c (build_array_ref): Call warn_array_subscript_range. * testsuite/gcc.dg/Warray-bounds.c: Updated for frontend warnings, additional tests for arrays of size 0 and size 1. * testsuite/g++.dg/warn/Warray-bounds.c: Ditto. * testsuite/gcc.dg/Warray-bounds-noopt.c: New testcase. * testsuite/g++.dg/warn/Warray-bounds-noopt.c: Ditto. * typeck.c (build_array_ref): Call warn_array_subscript_range. From-SVN: r134889
Diffstat (limited to 'gcc/cp/typeck.c')
-rw-r--r--gcc/cp/typeck.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 1447182..bf264ad 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -2556,8 +2556,7 @@ build_array_ref (tree array, tree idx)
if (TREE_CODE (TREE_TYPE (array)) == ARRAY_TYPE)
{
- bool has_warned_on_bounds_check = false;
- tree rval, type, ref;
+ tree rval, type;
warn_array_subscript_with_type_char (idx);
@@ -2574,10 +2573,6 @@ build_array_ref (tree array, tree idx)
pointer arithmetic.) */
idx = perform_integral_promotions (idx);
- /* Warn about any obvious array bounds errors for fixed size arrays that
- are indexed by a constant. */
- has_warned_on_bounds_check = warn_array_subscript_range (array, idx);
-
/* An array that is indexed by a non-constant
cannot be stored in a register; we must be able to do
address arithmetic on its address.
@@ -2628,12 +2623,7 @@ build_array_ref (tree array, tree idx)
|= (CP_TYPE_VOLATILE_P (type) | TREE_SIDE_EFFECTS (array));
TREE_THIS_VOLATILE (rval)
|= (CP_TYPE_VOLATILE_P (type) | TREE_THIS_VOLATILE (array));
- ref = require_complete_type (fold_if_not_in_template (rval));
-
- /* Suppress bounds warning in tree-vrp.c if already warned here. */
- if (has_warned_on_bounds_check)
- TREE_NO_WARNING (ref) = 1;
- return ref;
+ return require_complete_type (fold_if_not_in_template (rval));
}
{