diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/gomp')
-rw-r--r-- | gcc/testsuite/gcc.dg/gomp/adjust-args-1.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/gomp/append-args-1.c | 28 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/gomp/declare-variant-3.c | 18 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/gomp/pr121453.c | 18 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/gomp/unprototyped-variant.c | 30 |
5 files changed, 83 insertions, 13 deletions
diff --git a/gcc/testsuite/gcc.dg/gomp/adjust-args-1.c b/gcc/testsuite/gcc.dg/gomp/adjust-args-1.c index 90787ef..d67db5e 100644 --- a/gcc/testsuite/gcc.dg/gomp/adjust-args-1.c +++ b/gcc/testsuite/gcc.dg/gomp/adjust-args-1.c @@ -11,7 +11,7 @@ int f1 (int); int f2 (void *a); #pragma omp declare variant (f1) match (construct={dispatch}) adjust_args (other: a) /* { dg-error "expected 'nothing' or 'need_device_ptr'" } */ int f3 (int a); -#pragma omp declare variant (f0) adjust_args (nothing: a) /* { dg-error "an 'adjust_args' clause requires a 'match' clause" } */ +#pragma omp declare variant (f0) adjust_args (nothing: a) /* { dg-error "expected 'match' clause" } */ int f4 (void *a); #pragma omp declare variant (f1) match (construct={dispatch}) adjust_args () /* { dg-error "expected 'nothing' or 'need_device_ptr' followed by ':'" } */ int f5 (int a); diff --git a/gcc/testsuite/gcc.dg/gomp/append-args-1.c b/gcc/testsuite/gcc.dg/gomp/append-args-1.c index 81dd106..15fc752 100644 --- a/gcc/testsuite/gcc.dg/gomp/append-args-1.c +++ b/gcc/testsuite/gcc.dg/gomp/append-args-1.c @@ -15,56 +15,60 @@ typedef enum omp_interop_t } omp_interop_t; -/* (A) No prototype for the variant but for the base function. */ +/* (A) No prototype for the variant but for the base function. + This is OK, the unprototyped decl is compatible with the modified + argument list. */ void variant_fn1(); #pragma omp declare variant(variant_fn1) match(construct={dispatch}) append_args(interop(target)) \ adjust_args(need_device_ptr: x,y) void bar1(int *x, int *y); -/* { dg-error "variant 'variant_fn1' and base 'bar1' have incompatible types" "" { target *-*-* } .-3 } */ void variant_fn2(); #pragma omp declare variant(variant_fn2) match(construct={dispatch}) append_args(interop(target)) void bar2(int *x, int *y); -/* { dg-error "variant 'variant_fn2' and base 'bar2' have incompatible types" "" { target *-*-* } .-2 } */ -/* (B) No prototype for the variant nor for the base function. */ +/* (B) No prototype for the variant nor for the base function. + The declarations are compatible, but adjust_args requires a prototyped + base function so that we know where in the arglist to insert the additional + omp_interop_t arguments. */ -void variant_fn3(); /* { dg-error "argument 1 of 'variant_fn3' must be of 'omp_interop_t'" } */ +void variant_fn3(); #pragma omp declare variant(variant_fn3) match(construct={dispatch}) append_args(interop(target)) \ adjust_args(need_device_ptr: x,y) void bar3(); /* { dg-error "'x' undeclared here \\(not in a function\\)" "" { target *-*-* } .-2 } */ /* { dg-error "'y' undeclared here \\(not in a function\\)" "" { target *-*-* } .-3 } */ -/* { dg-note "'append_args' specified here" "" { target *-*-* } .-5 } */ +/* { dg-message "'append_args' with unprototyped base function" "" { target *-*-* } .-5 } */ -void variant_fn4(); /* { dg-error "argument 1 of 'variant_fn4' must be of 'omp_interop_t'" } */ +void variant_fn4(); #pragma omp declare variant(variant_fn4) match(construct={dispatch}) append_args(interop(target)) void bar4(); -/* { dg-note "'append_args' specified here" "" { target *-*-* } .-2 } */ +/* { dg-message "'append_args' with unprototyped base function" "" { target *-*-* } .-2 } */ -/* (C) Only a prototype on the variant-function side. */ +/* (C) Only a prototype on the variant-function side. Again, the base + function requires a prototype with append_args. */ void variant_fn5(omp_interop_t, omp_interop_t); #pragma omp declare variant(variant_fn5) match(construct={dispatch}) append_args(interop(target)) \ adjust_args(need_device_ptr: x,y) void bar5(); -/* { dg-error "variant 'variant_fn5' and base 'bar5' have incompatible types" "" { target *-*-* } .-3 } */ +/* { dg-message "'append_args' with unprototyped base function" "" { target *-*-* } .-3 } */ void variant_fn6(omp_interop_t, omp_interop_t); #pragma omp declare variant(variant_fn6) match(construct={dispatch}) append_args(interop(target)) void bar6(); -/* { dg-error "variant 'variant_fn6' and base 'bar6' have incompatible types" "" { target *-*-* } .-2 } */ +/* { dg-message "'append_args' with unprototyped base function" "" { target *-*-* } .-2 } */ void variant_fn7(int *, int, omp_interop_t, omp_interop_t); #pragma omp declare variant(variant_fn7) match(construct={dispatch}) append_args(interop(target)) void bar7(); -/* { dg-error "variant 'variant_fn7' and base 'bar7' have incompatible types" "" { target *-*-* } .-2 } */ +/* { dg-message "'append_args' with unprototyped base function" "" { target *-*-* } .-2 } */ diff --git a/gcc/testsuite/gcc.dg/gomp/declare-variant-3.c b/gcc/testsuite/gcc.dg/gomp/declare-variant-3.c new file mode 100644 index 0000000..92b71fe --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/declare-variant-3.c @@ -0,0 +1,18 @@ +/* PR118839: Check that error is diagnosed when the variant is the same as + the base function. */ + +/* No previous declaration. */ +#pragma omp declare variant(f) match(user={condition(1)}) /* { dg-error "variant 'f' is the same as base function" } */ +void f(int *x); + +/* Previous declaration. */ +void g(int *x) +{ + *x = 42; +} + +#pragma omp declare variant(g) match(user={condition(1)}) /* { dg-error "variant 'g' is the same as base function" } */ +void g(int *x); + + + diff --git a/gcc/testsuite/gcc.dg/gomp/pr121453.c b/gcc/testsuite/gcc.dg/gomp/pr121453.c new file mode 100644 index 0000000..74014e6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/pr121453.c @@ -0,0 +1,18 @@ +/* PR middle-end/121453 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp -O2 -Wuninitialized" } */ + +void bar (int, int, int); +int v[40][40][40]; + +void +foo (int x, int y, int z) +{ + int i, j, k; +#pragma omp parallel for simd collapse(3) + for (k = 1; k <= z; ++k) + for (j = 2; j <= y - 1; ++j) + for (i = 1; i <= x; ++i) + v[i][j][k] = 0; + bar (i, j, k); +} diff --git a/gcc/testsuite/gcc.dg/gomp/unprototyped-variant.c b/gcc/testsuite/gcc.dg/gomp/unprototyped-variant.c new file mode 100644 index 0000000..ca84775 --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/unprototyped-variant.c @@ -0,0 +1,30 @@ +/* { dg-additional-options "-std=gnu90" } */ + +/* This test case used to ICE in the gimplifier after issuing a + different diagnostic message. */ + +#if __cplusplus >= 201103L +# define __GOMP_UINTPTR_T_ENUM : __UINTPTR_TYPE__ +#else +# define __GOMP_UINTPTR_T_ENUM +#endif + +typedef enum omp_interop_t __GOMP_UINTPTR_T_ENUM +{ + omp_interop_none = 0, + __omp_interop_t_max__ = __UINTPTR_MAX__ +} omp_interop_t; + + +void g2(); +#pragma omp declare variant(g2) match(construct={dispatch}) append_args(interop(target,targetsync)) /* { dg-message "'append_args' with unprototyped base function" } */ +void f2(); + +void foo() +{ + omp_interop_t obj6 = omp_interop_none; + const char *cp = 0L; + + #pragma omp dispatch interop(obj6) + f2(5, cp); +} |