summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pointer-arith-4.c
diff options
context:
space:
mode:
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2004-11-20 20:31:52 +0000
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2004-11-20 20:31:52 +0000
commit20931c08f468f8239334ec3d938e7554a8819998 (patch)
tree744160b47cb98a4ccacd021c089dc864bfb2cedd /gcc/testsuite/gcc.dg/pointer-arith-4.c
parentbb30f677e665bca25e979d13b23a9fc83c83d883 (diff)
downloadgcc-20931c08f468f8239334ec3d938e7554a8819998.tar.gz
* c-typeck.c (build_array_ref): Don't check for index == 0. Make
checks for neither argument being an array or pointer (swapping the arguments if necessary), the array argument being a pointer to or array of functions and for -Wchar-subscripts warnings upfront. testsuite: * gcc.dg/Wchar-subscripts-1.c, gcc.dg/array-8.c: New tests. * gcc.dg/pointer-arith-1.c, gcc.dg/pointer-arith-2.c, gcc.dg/pointer-arith-3.c, gcc.dg/pointer-arith-4.c: Update expected diagnostics. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@90969 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/pointer-arith-4.c')
-rw-r--r--gcc/testsuite/gcc.dg/pointer-arith-4.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/testsuite/gcc.dg/pointer-arith-4.c b/gcc/testsuite/gcc.dg/pointer-arith-4.c
index 3e577fc1cb5..b17f9d7a335 100644
--- a/gcc/testsuite/gcc.dg/pointer-arith-4.c
+++ b/gcc/testsuite/gcc.dg/pointer-arith-4.c
@@ -34,8 +34,8 @@ g (void)
/* { dg-error "error: pointer of type 'void \\*' used in arithmetic" "array 1" { target *-*-* } 33 } */
0[p]; /* { dg-warning "warning: dereferencing 'void \\*' pointer" } */
/* { dg-error "error: pointer of type 'void \\*' used in arithmetic" "array 1" { target *-*-* } 35 } */
- f[0]; /* { dg-error "error: subscripted value is neither array nor pointer" } */
- 0[f]; /* { dg-error "error: subscripted value is neither array nor pointer" } */
+ f[0]; /* { dg-error "error: subscripted value is pointer to function" } */
+ 0[f]; /* { dg-error "error: subscripted value is pointer to function" } */
p - p; /* { dg-error "error: pointer of type 'void \\*' used in subtraction" } */
f - f; /* { dg-error "error: pointer to a function used in subtraction" } */
}