diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/gupc/invalid-local-ptr-to-void-arith.upc')
-rw-r--r-- | gcc/testsuite/gcc.dg/gupc/invalid-local-ptr-to-void-arith.upc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/gupc/invalid-local-ptr-to-void-arith.upc b/gcc/testsuite/gcc.dg/gupc/invalid-local-ptr-to-void-arith.upc new file mode 100644 index 00000000000..676e09e8e42 --- /dev/null +++ b/gcc/testsuite/gcc.dg/gupc/invalid-local-ptr-to-void-arith.upc @@ -0,0 +1,21 @@ +/* The consensus of the UPC community seems to be that + arithmetic on (void *) pointers is a compilation error. + { dg-do compile } + { dg-options "-fupc-threads=2" } */ + +/* The base address of the UPC shared section */ +extern char __upc_shared_start[1]; + + + +int A[10]; +void *p; + +int main() +{ + p = (void *)A; + p = p + 1; /* { dg-error "pointer of type 'void \\*' used in arithmetic \\\[-Werror=pointer-arith\\\]" } */ + *((int *)p) = 1; + return 0; +} +/* { dg-excess-errors "some warnings being treated as errors" } */ |