Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / testsuite / gcc.dg / pointer-arith-1.c
blob3bf78873e8fe85397df777706d6c0be62b9d3783
1 /* Test diagnostics for arithmetic on void and function pointers.
2 Test with no special options. */
3 /* Origin: Joseph Myers <joseph@codesourcery.com> */
4 /* { dg-do compile } */
5 /* { dg-options "" } */
7 void *p;
8 void (*f)(void);
10 void
11 g (void)
13 p + 0;
14 p + 1;
15 0 + p;
16 1 + p;
17 p - 0;
18 p - 1;
19 p += 0;
20 p += 1;
21 p -= 0;
22 p -= 1;
23 f + 0;
24 f + 1;
25 0 + f;
26 1 + f;
27 f - 0;
28 f - 1;
29 f += 0;
30 f += 1;
31 f -= 0;
32 f -= 1;
33 p[0]; /* { dg-warning "warning: dereferencing 'void \\*' pointer" } */
34 0[p]; /* { dg-warning "warning: dereferencing 'void \\*' pointer" } */
35 f[0]; /* { dg-error "error: subscripted value is pointer to function" } */
36 0[f]; /* { dg-error "error: subscripted value is pointer to function" } */
37 p - p;
38 f - f;