===================================================================
@@ -0,0 +1,22 @@
+/* Invalid & operation applied to a UPC shared bit field.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+shared struct
+ {
+ int a;
+ int b : 8;
+ int c : 24;
+ } x;
+
+shared int *pts;
+
+int main (void)
+{
+ pts = &x.b; /* { dg-error "cannot take address of bit-field 'b'" } */
+ return 0;
+}
===================================================================
@@ -0,0 +1,20 @@
+/* UPC does not allow assignments from a local pointer
+ to a pointer-to-shared.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+int x;
+
+shared int *pts;
+
+int main (void)
+{
+ int *local_ptr = &x;
+ pts = local_ptr; /* { dg-error "UPC does not allow assignments from a local pointer to a pointer-to-shared" } */
+ return 0;
+}
===================================================================
@@ -0,0 +1,18 @@
+/* UPC does not allow assignments
+ from a pointer-to-shared to a local pointer.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+shared int *pts;
+
+int main (void)
+{
+ int *local_ptr = pts; /* { dg-error "UPC does not allow assignments from a pointer-to-shared to a local pointer" } */
+ *local_ptr = 1;
+ return 0;
+}
===================================================================
@@ -0,0 +1,22 @@
+/* UPC does not allow assignment
+ between pointers to shared with
+ differing block sizes without a cast.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+shared [3] int A3[3*THREADS];
+shared [5] int A5[5*THREADS];
+
+shared [3] int *p3 = A3;
+shared [5] int *p5 = A5;
+
+int main (void)
+{
+ p3 = p5; /* { dg-error "UPC does not allow assignment between pointers to shared with differing block sizes without a cast" } */
+ return 0;
+}
===================================================================
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* Runtime API */
+extern void __upc_barrier (int);
+extern void __upc_notify (int);
+extern void __upc_wait (int);
+
+int main () {
+ /* { dg-final { scan-tree-dump-times "__upc_barrier \\\(123\\\)" 1 "original" } } */
+ upc_barrier 123;
+ /* { dg-final { scan-tree-dump-times "__upc_notify \\\(456\\\)" 1 "original" } } */
+ upc_notify 456;
+ /* { dg-final { scan-tree-dump-times "__upc_wait \\\(456\\\)" 1 "original" } } */
+ upc_wait 456;
+ return 0;
+}
===================================================================
@@ -0,0 +1,10 @@
+/* UPC layout qualifier cannot be applied to a void type.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+shared [5] void *pts; /* { dg-error "UPC layout qualifier cannot be applied to a void type" } */
===================================================================
@@ -0,0 +1,12 @@
+/* UPC layout qualifier is incompatible with the referenced type.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+typedef shared [3] int array_blocked_3_type[30];
+
+shared [5] array_blocked_3_type A[THREADS]; /* { dg-error "UPC layout qualifier is incompatible with the referenced type" } */
===================================================================
@@ -0,0 +1,10 @@
+/* UPC layout qualifier is not an integral constant.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+shared [0.5] int A[10*THREADS]; /* { dg-error "UPC layout qualifier is not an integral constant" } */
===================================================================
@@ -0,0 +1,16 @@
+/* UPC does not allow casts from an integer to a pointer-to-shared.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+extern void __putsi2 (upc_shared_ptr_t, int);
+
+
+
+int main (void)
+{
+ shared int *pts = (shared int *)0x400; /* { dg-error "UPC does not allow casts from an integer to a pointer-to-shared" } */
+ *pts = 1;
+ return 0;
+}
===================================================================
@@ -0,0 +1,19 @@
+/* UPC does not allow casts from a local pointer to a pointer-to-shared.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+extern void __putsi2 (upc_shared_ptr_t, int);
+
+
+
+int x;
+
+int main (void)
+{
+ int *local_ptr = &x;
+ shared int *pts = (shared int *)local_ptr; /* { dg-error "UPC does not allow casts from a local pointer to a pointer-to-shared" } */
+ *pts = 1;
+ return 0;
+}
===================================================================
@@ -0,0 +1,22 @@
+/* UPC does not allow comparisons between pointers to shared and
+ local pointers.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+int x;
+shared int v;
+
+shared int *pts;
+int *local_ptr;
+
+int main (void)
+{
+ local_ptr = &x;
+ pts = &v;
+ return pts == local_ptr; /* { dg-error "UPC does not allow comparisons between pointers to shared and local pointers" } */
+}
===================================================================
@@ -0,0 +1,16 @@
+/* { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+shared [10] int *p10;
+
+shared [20] int *p20;
+
+int
+main ()
+{
+ return p10 == p20; /* { dg-error "UPC does not allow comparison between pointers to shared with differing block sizes without a cast" } */
+}
===================================================================
@@ -0,0 +1,16 @@
+/* { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+shared int *p1;
+
+shared [20] int *p20;
+
+int
+main ()
+{
+ return p1 == p20; /* { dg-error "UPC does not allow comparison between pointers to shared with differing block sizes without a cast" } */
+}
===================================================================
@@ -0,0 +1,16 @@
+/* { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+shared [] int *p0;
+
+shared int *p1;
+
+int
+main ()
+{
+ return p0 == p1; /* { dg-error "UPC does not allow comparison between pointers to shared with differing block sizes without a cast" } */
+}
===================================================================
@@ -0,0 +1,16 @@
+/* { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+shared [10] int *p10;
+
+shared [20] int *p20;
+
+int
+main ()
+{
+ return p10 > p20; /* { dg-error "UPC does not allow comparison between pointers to shared with differing block sizes without a cast" } */
+}
===================================================================
@@ -0,0 +1,16 @@
+/* { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+shared int *p1;
+
+shared [20] int *p20;
+
+int
+main ()
+{
+ return p1 > p20; /* { dg-error "UPC does not allow comparison between pointers to shared with differing block sizes without a cast" } */
+}
===================================================================
@@ -0,0 +1,16 @@
+/* { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+shared [] int *p0;
+
+shared int *p1;
+
+int
+main ()
+{
+ return p0 > p1; /* { dg-error "UPC does not allow comparison between pointers to shared with differing block sizes without a cast" } */
+}
===================================================================
@@ -0,0 +1,10 @@
+/* Two or more layout qualifiers specified.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+shared [10] shared [20] int x[200*THREADS]; /* { dg-error "two or more layout qualifiers specified" } */
===================================================================
@@ -0,0 +1,15 @@
+/* ‘barrier_notify’ was supported in version 1.0 of the UPC specification,
+ it has been deprecated, use ‘upc_notify’ instead.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+int main()
+{
+ barrier_notify; /* { dg-error "'barrier_notify' was supported in version 1.0 of the UPC specification, it has been deprecated, use 'upc_notify' instead" } */
+ return 0;
+}
===================================================================
@@ -0,0 +1,15 @@
+/* ‘barrier’ was supported in version 1.0 of the UPC specification,
+ it has been deprecated, use ‘upc_barrier’ instead.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+int main()
+{
+ barrier; /* { dg-error "'barrier' was supported in version 1.0 of the UPC specification, it has been deprecated, use 'upc_barrier' instead" } */
+ return 0;
+}
===================================================================
@@ -0,0 +1,15 @@
+/* ‘barrier_wait’ was supported in version 1.0 of the UPC specification,
+ it has been deprecated, use ‘upc_wait’ instead.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+int main()
+{
+ barrier_wait; /* { dg-error "'barrier_wait' was supported in version 1.0 of the UPC specification, it has been deprecated, use 'upc_wait' instead" } */
+ return 0;
+}
===================================================================
@@ -0,0 +1,24 @@
+/* Attempt to take the difference of a UPC pointer-to-shared
+ and a local pointer.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+int x;
+shared int v;
+
+shared int *pts;
+int *local_ptr;
+int diff;
+
+int main (void)
+{
+ local_ptr = &x;
+ pts = &v;
+ diff = (pts - local_ptr); /* { dg-error "attempt to take the difference of a UPC pointer-to-shared and a local pointer" } */
+ return 0;
+}
===================================================================
@@ -0,0 +1,12 @@
+/* UPC shared array declaration references THREADS
+ more than once; the size cannot be calculated.
+ { dg-do compile }
+ { dg-options "-fupc-threads=0" } */
+
+extern int THREADS;
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+shared int A[THREADS][THREADS]; /* { dg-error "UPC shared array declaration references THREADS more than once; the size of 'A' cannot be calculated" } */
===================================================================
@@ -0,0 +1,12 @@
+/* UPC shared array dimension is not a simple multiple
+ of THREADS; the size cannot be calculated.
+ { dg-do compile }
+ { dg-options "-fupc-threads=0" } */
+
+extern int THREADS;
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+shared int A[10*THREADS + 1]; /* { dg-error "UPC shared array dimension is not a simple multiple of THREADS; the size of 'A' cannot be calculated." } */
===================================================================
@@ -0,0 +1,14 @@
+/* A UPC layout qualifier of '[*]' requires that
+ the array size is either an integral constant
+ or an integral multiple of THREADS.
+ { dg-do compile }
+ { dg-options "-fupc-threads=0" } */
+
+extern int THREADS;
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+shared [*] int A[THREADS+1]; /* { dg-error "UPC shared array dimension is not a simple multiple of THREADS; the size of 'A' cannot be calculated." } */
+/* { dg-prune-output "a UPC layout qualifier of '\\\[\\*\\\]' requires that the array size is either an integral constant or an integral multiple of THREADS" } */
===================================================================
@@ -0,0 +1,14 @@
+/* In the UPC dynamic translation environment,
+ THREADS must appear exactly once in
+ declarations of shared arrays;
+ the storage size cannot be calculated.
+ { dg-do compile }
+ { dg-options "-fupc-threads=0" } */
+
+extern int THREADS;
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+shared int A[THREADS*THREADS]; /* { dg-error "UPC shared array declaration references THREADS more than once; the size of 'A' cannot be calculated" } */
===================================================================
@@ -0,0 +1,13 @@
+/* In the UPC dynamic translation environment,
+ THREADS may not appear in declarations
+ of shared arrays with indefinite block size;
+ the storage size cannot be calculated.
+ { dg-do compile }
+ { dg-options "-fupc-threads=0" } */
+
+extern int THREADS;
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+shared [] int A[THREADS]; /* { dg-error "in the UPC dynamic translation environment, THREADS may not appear in declarations of shared arrays with indefinite block size; the storage size of 'A' cannot be calculated" } */
===================================================================
@@ -0,0 +1,15 @@
+/* Field declared with UPC shared qualifier.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+struct S_struct
+ {
+ int field1;
+ shared double field2; /* { dg-error "field 'field2' declared with UPC shared qualifier" } */
+ char field3;
+ };
===================================================================
@@ -0,0 +1,13 @@
+/* Function definition has UPC shared qualified return type.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+shared int return_shared_int (void) /* { dg-error "function definition has UPC shared qualified return type" } */
+{
+ return 0;
+}
===================================================================
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef struct { unsigned char c[16]; } blk_t;
+
+/* UPC runtime remote access prototype */
+typedef __SIZE_TYPE__ size_t;
+extern blk_t __getblk3 (void *, upc_shared_ptr_t, size_t);
+
+relaxed shared blk_t x;
+blk_t local_x;
+
+void p () {
+ local_x = x;
+}
+
+/* { dg-final { scan-tree-dump-times "getblk3" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
===================================================================
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef struct { unsigned char c[16]; } blk_t;
+
+/* UPC runtime remote access prototype */
+typedef __SIZE_TYPE__ size_t;
+extern blk_t __getsblk3 (void *, upc_shared_ptr_t, size_t);
+
+strict shared blk_t x;
+blk_t local_x;
+
+void p () {
+ local_x = x;
+}
+
+/* { dg-final { scan-tree-dump-times "getsblk3" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
===================================================================
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+/* UPC runtime remote access prototype */
+extern double __getdf2 (upc_shared_ptr_t);
+
+relaxed shared double x;
+
+double p () {
+ return x;
+}
+
+/* { dg-final { scan-tree-dump-times "getdf2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
===================================================================
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+/* UPC runtime remote access prototype */
+extern double __getsdf2 (upc_shared_ptr_t);
+
+strict shared double x;
+
+double p () {
+ return x;
+}
+
+/* { dg-final { scan-tree-dump-times "getsdf2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
===================================================================
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef unsigned int uint_di_t __attribute__ ((__mode__(__DI__)));
+
+/* UPC runtime remote access prototype */
+extern uint_di_t __getdi2 (upc_shared_ptr_t);
+
+relaxed shared uint_di_t x;
+
+uint_di_t p () {
+ return x;
+}
+
+/* { dg-final { scan-tree-dump-times "getdi2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
===================================================================
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef unsigned int uint_di_t __attribute__ ((__mode__(__DI__)));
+
+/* UPC runtime remote access prototype */
+extern uint_di_t __getsdi2 (upc_shared_ptr_t);
+
+strict shared uint_di_t x;
+
+uint_di_t p () {
+ return x;
+}
+
+/* { dg-final { scan-tree-dump-times "getsdi2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
===================================================================
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef unsigned int uint_hi_t __attribute__ ((__mode__(__HI__)));
+
+/* UPC runtime remote access prototype */
+extern uint_hi_t __gethi2 (upc_shared_ptr_t);
+
+relaxed shared uint_hi_t x;
+
+uint_hi_t p () {
+ return x;
+}
+
+/* { dg-final { scan-tree-dump-times "gethi2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
===================================================================
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef unsigned int uint_hi_t __attribute__ ((__mode__(__HI__)));
+
+/* UPC runtime remote access prototype */
+extern uint_hi_t __getshi2 (upc_shared_ptr_t);
+
+strict shared uint_hi_t x;
+
+uint_hi_t p () {
+ return x;
+}
+
+/* { dg-final { scan-tree-dump-times "getshi2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
===================================================================
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef unsigned int uint_qi_t __attribute__ ((__mode__(__QI__)));
+
+/* UPC runtime remote access prototype */
+extern uint_qi_t __getqi2 (upc_shared_ptr_t);
+
+relaxed shared uint_qi_t x;
+
+uint_qi_t p () {
+ return x;
+}
+
+/* { dg-final { scan-tree-dump-times "getqi2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
===================================================================
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef unsigned int uint_qi_t __attribute__ ((__mode__(__QI__)));
+
+/* UPC runtime remote access prototype */
+extern uint_qi_t __getsqi2 (upc_shared_ptr_t);
+
+strict shared uint_qi_t x;
+
+uint_qi_t p () {
+ return x;
+}
+
+/* { dg-final { scan-tree-dump-times "getsqi2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
===================================================================
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+/* UPC runtime remote access prototype */
+extern float __getsf2 (upc_shared_ptr_t);
+
+relaxed shared float x;
+
+float p () {
+ return x;
+}
+
+/* { dg-final { scan-tree-dump-times "getsf2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
===================================================================
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+/* UPC runtime remote access prototype */
+extern float __getssf2 (upc_shared_ptr_t);
+
+strict shared float x;
+
+float p () {
+ return x;
+}
+
+/* { dg-final { scan-tree-dump-times "getssf2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
===================================================================
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef unsigned int uint_si_t __attribute__ ((__mode__(__SI__)));
+
+/* UPC runtime remote access prototype */
+extern uint_si_t __getsi2 (upc_shared_ptr_t);
+
+relaxed shared uint_si_t x;
+
+uint_si_t p () {
+ return x;
+}
+
+/* { dg-final { scan-tree-dump-times "getsi2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
===================================================================
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef unsigned int uint_si_t __attribute__ ((__mode__(__SI__)));
+
+/* UPC runtime remote access prototype */
+extern uint_si_t __getssi2 (upc_shared_ptr_t);
+
+strict shared uint_si_t x;
+
+uint_si_t p () {
+ return x;
+}
+
+/* { dg-final { scan-tree-dump-times "getssi2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
===================================================================
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+/* { dg-require-effective-target longdouble128 } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+/* UPC runtime remote access prototype */
+extern long double __gettf2 (upc_shared_ptr_t);
+extern long double __getxf2 (upc_shared_ptr_t);
+
+relaxed shared long double x;
+
+long double p () {
+ return x;
+}
+
+/* { dg-final { scan-tree-dump-times "get\[tx\]f2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
===================================================================
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+/* { dg-require-effective-target longdouble128 } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+/* UPC runtime remote access prototype */
+extern long double __getstf2 (upc_shared_ptr_t);
+extern long double __getsxf2 (upc_shared_ptr_t);
+
+strict shared long double x;
+
+long double p () {
+ return x;
+}
+
+/* { dg-final { scan-tree-dump-times "gets\[tx\]f2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
===================================================================
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+/* { dg-require-effective-target int128 } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef unsigned int uint_ti_t __attribute__ ((__mode__(__TI__)));
+
+/* UPC runtime remote access prototype */
+typedef __SIZE_TYPE__ size_t;
+extern uint_ti_t __getblk3 (void *, upc_shared_ptr_t, size_t);
+
+relaxed shared uint_ti_t x;
+
+uint_ti_t p () {
+ return x;
+}
+
+/* { dg-final { scan-tree-dump-times "getblk3" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
===================================================================
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+/* { dg-require-effective-target int128 } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef unsigned int uint_ti_t __attribute__ ((__mode__(__TI__)));
+
+/* UPC runtime remote access prototype */
+typedef __SIZE_TYPE__ size_t;
+extern uint_ti_t __getsblk3 (void *, upc_shared_ptr_t, size_t);
+
+strict shared uint_ti_t x;
+
+uint_ti_t p () {
+ return x;
+}
+
+/* { dg-final { scan-tree-dump-times "getsblk3" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
===================================================================
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* Runtime API */
+extern void * __getaddr (upc_shared_ptr_t);
+
+shared int *p;
+
+int main () {
+ int *local_p;
+ /* { dg-final { scan-tree-dump-times "local_p = .*__getaddr.* p\\\)" 1 "original" } } */
+ local_p = (void *)p;
+ return 0;
+}
===================================================================
@@ -0,0 +1,40 @@
+# Copyright (C) 2006-2015 Free Software Foundation, Inc.
+#
+# This file is part of GCC.
+#
+# GCC is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GCC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# GCC testsuite that uses the `dg.exp' driver.
+
+# Load support procs.
+load_lib gcc-dg.exp
+
+if ![check_effective_target_fupc] {
+ return
+}
+
+# For all the test files in the 'gcc.dg/gupc' directory,
+# we only *compile* the programs and must disable the
+# pre-include of gcc-upc.h via -fno-upc-pre-include.
+set upc_flags "-fno-upc-pre-include"
+
+# Initialize `dg'.
+dg-init
+
+# Main loop.
+dg-runtest [lsort [find $srcdir/$subdir *.upc]] "$upc_flags" ""
+
+# All done.
+dg-finish
===================================================================
@@ -0,0 +1,18 @@
+/* Initialization attempts to make a UPC pointer-to-shared value
+ from an integer without a cast.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+shared int *p_4000;
+
+int main()
+{
+ shared int *p = 0x4000; /* { dg-error "initialization attempts to make a UPC pointer-to-shared value from an integer without a cast" } */
+ p_4000 = p;
+ return 0;
+}
===================================================================
@@ -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" } */
===================================================================
@@ -0,0 +1,21 @@
+/* Invalid application of <op> to shared void.
+ (where <op> is sizeof(0) or __alignof())
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+typedef __SIZE_TYPE__ size_t;
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+shared int A[THREADS];
+
+size_t size;
+
+int main()
+{
+ shared void *p = (shared void *)A;
+ size = sizeof (*p); /* { dg-error "invalid application of 'sizeof' to 'shared void' type" } */
+ return 0;
+}
===================================================================
@@ -0,0 +1,16 @@
+/* The consensus of the UPC community seems to be that
+ sizeof (void) is a compilation errors.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+int main()
+{
+ return sizeof (void); /* { dg-error "invalid application of 'sizeof' to a void type \\\[-Werror=pointer-arith\\\]" } */
+}
+
+/* { dg-excess-errors "some warnings being treated as errors" } */
===================================================================
@@ -0,0 +1,22 @@
+/* UPC does not allow comparisons between pointers to shared and
+ local pointers.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+int x;
+shared int v;
+
+shared int *pts;
+int *local_ptr;
+
+int main (void)
+{
+ local_ptr = &x;
+ pts = &v;
+ return pts < local_ptr; /* { dg-error "UPC does not allow comparisons between pointers to shared and local pointers" } */
+}
===================================================================
@@ -0,0 +1,10 @@
+/* Maximum UPC block size in this implementation exceeded.
+ { dg-do compile }
+ { dg-options "-fupc-threads=1" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+shared [UPC_MAX_BLOCK_SIZE+1] int A[(UPC_MAX_BLOCK_SIZE+1)*THREADS]; /* { dg-error "the maximum UPC block size in this implementation is \[0-9\]\*" } */
===================================================================
@@ -0,0 +1,11 @@
+/* Expected ] after UPC layout qualifier expression.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+shared [5 int A[5 * THREADS]; /* { dg-error "expected \\\] before 'int'" } */
+
===================================================================
@@ -0,0 +1,13 @@
+/* Parameter declared with UPC shared qualifier.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+int decl_shared_parameter (shared int p) /* { dg-error "parameter declared with UPC shared qualifier" } */
+{
+ return p;
+}
===================================================================
@@ -0,0 +1,18 @@
+/* Passing argument attempts to make a UPC pointer-to-shared
+ value from an integer.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+
+extern void proc (shared int *arg);
+
+int main()
+{
+ proc (0x4000); /* { dg-error "passing argument 1 of 'proc' attempts to make a UPC pointer-to-shared value from an integer" } */
+ return 0;
+}
===================================================================
@@ -0,0 +1,23 @@
+/* UPC does not allow a pointer of type `shared void *'
+ to be used in arithmetic.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+typedef __SIZE_TYPE__ size_t;
+extern int MYTHREAD;
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+shared int A[THREADS];
+shared void *pts;
+shared int *pts2;
+size_t diff;
+
+int main()
+{
+ pts = (shared void *)&A[0];
+ pts += (MYTHREAD + 1) % THREADS; /* { dg-error "UPC does not allow a pointer of type 'shared void \\*' to be used in arithmetic" } */
+ return 0;
+}
===================================================================
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef struct { unsigned char c[16]; } blk_t;
+
+/* UPC runtime remote access prototype */
+typedef __SIZE_TYPE__ size_t;
+extern void __putblk3 (upc_shared_ptr_t, void *, size_t);
+
+relaxed shared blk_t x;
+blk_t local_x;
+
+void p () {
+ x = local_x;
+}
+
+/* { dg-final { scan-tree-dump-times "putblk3" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
===================================================================
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef struct { unsigned char c[16]; } blk_t;
+
+/* UPC runtime remote access prototype */
+typedef __SIZE_TYPE__ size_t;
+extern void __putsblk3 (upc_shared_ptr_t, void *, size_t);
+
+strict shared blk_t x;
+blk_t local_x;
+
+void p () {
+ x = local_x;
+}
+
+/* { dg-final { scan-tree-dump-times "putsblk3" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
===================================================================
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+/* UPC runtime remote access prototype */
+extern void __putdf2 (upc_shared_ptr_t, double);
+
+relaxed shared double x;
+
+void p () {
+ x = 1;
+}
+
+/* { dg-final { scan-tree-dump-times "putdf2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
===================================================================
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+/* UPC runtime remote access prototype */
+extern void __putsdf2 (upc_shared_ptr_t, double);
+
+strict shared double x;
+
+void p () {
+ x = 1;
+}
+
+/* { dg-final { scan-tree-dump-times "putsdf2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
===================================================================
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef unsigned int uint_di_t __attribute__ ((__mode__(__DI__)));
+
+/* UPC runtime remote access prototype */
+extern void __putdi2 (upc_shared_ptr_t, uint_di_t);
+
+relaxed shared uint_di_t x;
+
+void p () {
+ x = 1;
+}
+
+/* { dg-final { scan-tree-dump-times "putdi2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
===================================================================
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef unsigned int uint_di_t __attribute__ ((__mode__(__DI__)));
+
+/* UPC runtime remote access prototype */
+extern void __putsdi2 (upc_shared_ptr_t, uint_di_t);
+
+strict shared uint_di_t x;
+
+void p () {
+ x = 1;
+}
+
+/* { dg-final { scan-tree-dump-times "putsdi2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
===================================================================
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef unsigned int uint_hi_t __attribute__ ((__mode__(__HI__)));
+
+/* UPC runtime remote access prototype */
+extern void __puthi2 (upc_shared_ptr_t, uint_hi_t);
+
+relaxed shared uint_hi_t x;
+
+void p () {
+ x = 1;
+}
+
+/* { dg-final { scan-tree-dump-times "puthi2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
===================================================================
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef unsigned int uint_hi_t __attribute__ ((__mode__(__HI__)));
+
+/* UPC runtime remote access prototype */
+extern void __putshi2 (upc_shared_ptr_t, uint_hi_t);
+
+strict shared uint_hi_t x;
+
+void p () {
+ x = 1;
+}
+
+/* { dg-final { scan-tree-dump-times "putshi2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
===================================================================
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef unsigned int uint_qi_t __attribute__ ((__mode__(__QI__)));
+
+/* UPC runtime remote access prototype */
+extern void __putqi2 (upc_shared_ptr_t, uint_qi_t);
+
+relaxed shared uint_qi_t x;
+
+void p () {
+ x = 1;
+}
+
+/* { dg-final { scan-tree-dump-times "putqi2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
===================================================================
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef unsigned int uint_qi_t __attribute__ ((__mode__(__QI__)));
+
+/* UPC runtime remote access prototype */
+extern void __putsqi2 (upc_shared_ptr_t, uint_qi_t);
+
+strict shared uint_qi_t x;
+
+void p () {
+ x = 1;
+}
+
+/* { dg-final { scan-tree-dump-times "putsqi2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
===================================================================
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+/* UPC runtime remote access prototype */
+extern void __putsf2 (upc_shared_ptr_t, float);
+
+relaxed shared float x;
+
+void p () {
+ x = 1;
+}
+
+/* { dg-final { scan-tree-dump-times "putsf2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
===================================================================
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+/* UPC runtime remote access prototype */
+extern void __putssf2 (upc_shared_ptr_t, float);
+
+strict shared float x;
+
+void p () {
+ x = 1;
+}
+
+/* { dg-final { scan-tree-dump-times "putssf2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
===================================================================
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef unsigned int uint_si_t __attribute__ ((__mode__(__SI__)));
+
+/* UPC runtime remote access prototype */
+extern void __putsi2 (upc_shared_ptr_t, uint_si_t);
+
+relaxed shared uint_si_t x;
+
+void p () {
+ x = 1;
+}
+
+/* { dg-final { scan-tree-dump-times "putsi2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
===================================================================
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef unsigned int uint_si_t __attribute__ ((__mode__(__SI__)));
+
+/* UPC runtime remote access prototype */
+extern void __putssi2 (upc_shared_ptr_t, uint_si_t);
+
+strict shared uint_si_t x;
+
+void p () {
+ x = 1;
+}
+
+/* { dg-final { scan-tree-dump-times "putssi2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
===================================================================
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+/* { dg-require-effective-target longdouble128 } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+/* UPC runtime remote access prototype */
+extern void __puttf2 (upc_shared_ptr_t, long double);
+extern void __putxf2 (upc_shared_ptr_t, long double);
+
+relaxed shared long double x;
+
+void p () {
+ x = 1;
+}
+
+/* { dg-final { scan-tree-dump-times "put\[tx\]f2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
===================================================================
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+/* { dg-require-effective-target longdouble128 } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+/* UPC runtime remote access prototype */
+extern void __putstf2 (upc_shared_ptr_t, long double);
+extern void __putsxf2 (upc_shared_ptr_t, long double);
+
+strict shared long double x;
+
+void p () {
+ x = 1;
+}
+
+/* { dg-final { scan-tree-dump-times "puts\[tx\]f2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
===================================================================
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+/* { dg-require-effective-target int128 } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef unsigned int uint_ti_t __attribute__ ((__mode__(__TI__)));
+
+/* UPC runtime remote access prototype */
+typedef __SIZE_TYPE__ size_t;
+extern void __putblk3 (upc_shared_ptr_t, void *, size_t);
+
+relaxed shared uint_ti_t x;
+
+void p () {
+ x = 1;
+}
+
+/* { dg-final { scan-tree-dump-times "putblk3" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
===================================================================
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+/* { dg-require-effective-target int128 } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+typedef unsigned int uint_ti_t __attribute__ ((__mode__(__TI__)));
+
+/* UPC runtime remote access prototype */
+typedef __SIZE_TYPE__ size_t;
+extern void __putsblk3 (upc_shared_ptr_t, void *, size_t);
+
+strict shared uint_ti_t x;
+
+void p () {
+ x = 1;
+}
+
+/* { dg-final { scan-tree-dump-times "putsblk3" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "get|put" 1 "original" } } */
===================================================================
@@ -0,0 +1,11 @@
+/* Variable is declared with UPC relaxed qualifier
+ but not shared.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+relaxed int x; /* { dg-error "'x' is declared with UPC relaxed qualifier but not shared" } */
===================================================================
@@ -0,0 +1,13 @@
+/* Return makes a UPC pointer-to-shared value from an integer.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+shared int *func ()
+{
+ return 0x4000; /* { dg-error "return makes a UPC pointer-to-shared value from an integer" } */
+}
===================================================================
@@ -0,0 +1,10 @@
+/* Initialization of UPC shared arrays is currently not supported.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+shared int A[3*THREADS] = {1, 2, 3}; /* { dg-error "initialization of UPC shared arrays is currently not supported" } */
===================================================================
@@ -0,0 +1,14 @@
+/* UPC does not support shared auto variables.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+int decl_shared_local (int p)
+{
+ shared int x = p; /* { dg-error "UPC does not support shared auto variables" } */
+ return x;
+}
===================================================================
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+/* Runtime API */
+extern void __upc_init_decls (void);
+extern void __putsi2 (upc_shared_ptr_t, int);
+
+shared int x = 10;
+
+shared int *xp = &x;
+
+int main () {
+ return 0;
+}
+/* { dg-final { scan-tree-dump-times "Function __upc_init_decls" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "__putsi2" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "xp = " 1 "original" } } */
===================================================================
@@ -0,0 +1,11 @@
+/* UPC shared variable %qE is declared
+ both strict and relaxed.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+shared strict relaxed int x; /* { dg-error "UPC shared variable 'x' is declared both strict and relaxed" } */
===================================================================
@@ -0,0 +1,15 @@
+/* UPC forbids the declaration of a variable-size shared array.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+void declare_shared_vla (int N)
+{
+ shared int A[N*THREADS]; /* { dg-error "UPC does not support shared auto variables" } */
+ A[0] = 1;
+}
+/* { dg-prune-output "UPC forbids variable-size shared array 'A'" } */
===================================================================
@@ -0,0 +1,11 @@
+/* UPC layout qualifier of the form [*] cannot be
+ applied to an incomplete type.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+shared [*] struct s_struct A5_icomplete[5*THREADS]; /* { dg-error "array type has incomplete element type" } */
===================================================================
@@ -0,0 +1,10 @@
+/* UPC [*] qualifier may not be used in declaration of pointers.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+shared [*] int *pts; /* { dg-error "UPC \\\[\\*\\\] qualifier may not be used in declaration of pointers" } */
===================================================================
@@ -0,0 +1,12 @@
+/* THREADS value exceeds UPC implementation limit.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2147483647" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+/* Must be compiled with large static value of THREADS. */
+shared int A[THREADS];
+/* { dg-excess-errors "THREADS value exceeds UPC implementation limit of 1024" } */
===================================================================
@@ -0,0 +1,11 @@
+/* Variable is declared with UPC strict qualifier
+ but not shared.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+strict int x; /* { dg-error "'x' is declared with UPC strict qualifier but not shared" } */
===================================================================
@@ -0,0 +1,20 @@
+/* UPC operator applied to a function type.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+typedef __SIZE_TYPE__ size_t;
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+
+void func(void) {}
+
+size_t s;
+
+int main()
+{
+ s = upc_blocksizeof (func); /* { dg-error "UPC operator upc_blocksizeof applied to a function type" } */
+ return 0;
+}
===================================================================
@@ -0,0 +1,18 @@
+/* UPC operator applied to a non-shared type.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+typedef __SIZE_TYPE__ size_t;
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+int x[10];
+size_t s;
+
+int main()
+{
+ s = upc_blocksizeof (x); /* { dg-error "UPC operator upc_blocksizeof applied to a non-shared type" } */
+ return 0;
+}
===================================================================
@@ -0,0 +1,19 @@
+/* UPC operator applied to a void type.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+typedef __SIZE_TYPE__ size_t;
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+void *p;
+size_t s;
+
+
+int main()
+{
+ s = upc_blocksizeof (*p); /* { dg-error "invalid use of void expression" } */
+ return 0;
+}
===================================================================
@@ -0,0 +1,20 @@
+/* UPC operator applied to a function type.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+typedef __SIZE_TYPE__ size_t;
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+
+void func(void) {}
+
+size_t s;
+
+int main()
+{
+ s = upc_elemsizeof (func); /* { dg-error "UPC operator upc_elemsizeof applied to a function type" } */
+ return 0;
+}
===================================================================
@@ -0,0 +1,18 @@
+/* UPC operator applied to a non-shared type.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+typedef __SIZE_TYPE__ size_t;
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+int x[10];
+size_t s;
+
+int main()
+{
+ s = upc_elemsizeof (x); /* { dg-error "UPC operator upc_elemsizeof applied to a non-shared type" } */
+ return 0;
+}
===================================================================
@@ -0,0 +1,19 @@
+/* UPC operator applied to a void type.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+typedef __SIZE_TYPE__ size_t;
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+void *p;
+size_t s;
+
+
+int main()
+{
+ s = upc_elemsizeof (*p); /* { dg-error "invalid use of void expression" } */
+ return 0;
+}
===================================================================
@@ -0,0 +1,20 @@
+/* UPC operator applied to a function type.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+typedef __SIZE_TYPE__ size_t;
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+
+void func(void) {}
+
+size_t s;
+
+int main()
+{
+ s = upc_localsizeof (func); /* { dg-error "UPC operator upc_localsizeof applied to a function type" } */
+ return 0;
+}
===================================================================
@@ -0,0 +1,18 @@
+/* UPC operator applied to a non-shared type.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+typedef __SIZE_TYPE__ size_t;
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+int x[10];
+size_t s;
+
+int main()
+{
+ s = upc_localsizeof (x); /* { dg-error "UPC operator upc_localsizeof applied to a non-shared type" } */
+ return 0;
+}
===================================================================
@@ -0,0 +1,19 @@
+/* UPC operator applied to a void type.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+typedef __SIZE_TYPE__ size_t;
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+void *p;
+size_t s;
+
+
+int main()
+{
+ s = upc_localsizeof (*p); /* { dg-error "invalid use of void expression" } */
+ return 0;
+}
===================================================================
@@ -0,0 +1,12 @@
+/* Warning: junk at end of #pragma upc.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+#pragma upc strict junk /* { dg-warning "junk at end of #pragma upc \\\[-Wpragmas\\\]" } */
+shared int x;
+
===================================================================
@@ -0,0 +1,12 @@
+/* Warning: missing parameter after #pragma upc.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+
+
+
+#pragma upc /* { dg-warning "missing parameter after #pragma upc \\\[-Wpragmas\\\]" } */
+shared int x;
+
===================================================================
@@ -0,0 +1,22 @@
+/* Warning: #pragma upc not allowed in this context.
+ { dg-do compile }
+ { dg-options "-fupc-threads=2" } */
+
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+extern void __putsi2 (upc_shared_ptr_t, int);
+
+
+shared int v;
+
+shared int *pts;
+
+int main (void)
+{
+ pts = &v;
+ /* pragma upc must appear contextually as first token
+ after opening brace. Invalid here. */
+ #pragma upc strict /* { dg-warning "#pragma upc not allowed in this context \\\[-Wpragmas\\\]" } */
+ *pts = 1;
+ return 0;
+}
===================================================================
@@ -876,6 +876,15 @@ proc check_effective_target_fopenmp {} {
} "-fopenmp"]
}
+# Return 1 if compilation with -fupc is error-free for trivial
+# code, 0 otherwise.
+
+proc check_effective_target_fupc {} {
+ return [check_no_compiler_messages fupc object {
+ void foo (void) { }
+ } "-fupc -fno-upc-pre-include"]
+}
+
# Return 1 if compilation with -fgnu-tm is error-free for trivial
# code, 0 otherwise.
@@ -6023,6 +6032,33 @@ proc add_options_for_double_vectors { fl
return $flags
}
+# Add to FLAGS the flags needed to disable inlining of
+# UPC run-time access routines.
+
+proc add_options_for_upc_library_calls { flags } {
+ return "$flags -fno-upc-inline-lib"
+}
+
+# Check if UPC struct pts build
+
+proc check_effective_target_upc_struct_pts { } {
+ return [check_no_compiler_messages upc_struct_pts object {
+ #ifndef __UPC_PTS_STRUCT_REP__
+ # error struct PTS is not supported
+ #endif
+ } "-fupc -fno-upc-pre-include" ]
+}
+
+# Check if UPC packed pts build
+
+proc check_effective_target_upc_packed_pts { } {
+ return [check_no_compiler_messages upc_packed_pts object {
+ #ifndef __UPC_PTS_PACKED_REP__
+ # error packed PTS is not supported
+ #endif
+ } "-fupc -fno-upc-pre-include" ]
+}
+
# Return 1 if the target provides a full C99 runtime.
proc check_effective_target_c99_runtime { } {