aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pointer-arith-3.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2004-11-20 20:31:52 +0000
committerJoseph Myers <jsm28@gcc.gnu.org>2004-11-20 20:31:52 +0000
commita4ab7973cfe5dfb4b191f795adaaddad831d7657 (patch)
tree744160b47cb98a4ccacd021c089dc864bfb2cedd /gcc/testsuite/gcc.dg/pointer-arith-3.c
parent40806b8b8f7a4d2ba6b926300f6a0dbcf862eb9d (diff)
downloadgcc-a4ab7973cfe5dfb4b191f795adaaddad831d7657.zip
gcc-a4ab7973cfe5dfb4b191f795adaaddad831d7657.tar.gz
gcc-a4ab7973cfe5dfb4b191f795adaaddad831d7657.tar.bz2
c-typeck.c (build_array_ref): Don't check for index == 0.
* 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. From-SVN: r90969
Diffstat (limited to 'gcc/testsuite/gcc.dg/pointer-arith-3.c')
-rw-r--r--gcc/testsuite/gcc.dg/pointer-arith-3.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/testsuite/gcc.dg/pointer-arith-3.c b/gcc/testsuite/gcc.dg/pointer-arith-3.c
index 90f5241..f23f677 100644
--- a/gcc/testsuite/gcc.dg/pointer-arith-3.c
+++ b/gcc/testsuite/gcc.dg/pointer-arith-3.c
@@ -34,8 +34,8 @@ g (void)
/* { dg-warning "warning: pointer of type 'void \\*' used in arithmetic" "array 1" { target *-*-* } 33 } */
0[p]; /* { dg-warning "warning: dereferencing 'void \\*' pointer" } */
/* { dg-warning "warning: 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-warning "warning: pointer of type 'void \\*' used in subtraction" } */
f - f; /* { dg-warning "warning: pointer to a function used in subtraction" } */
}