aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/c-c++-common')
-rw-r--r--gcc/testsuite/c-c++-common/goacc/pr69916.c2
-rw-r--r--gcc/testsuite/c-c++-common/gomp/append-args-1.c18
-rw-r--r--gcc/testsuite/c-c++-common/gomp/append-args-7.c4
-rw-r--r--gcc/testsuite/c-c++-common/gomp/append-args-8.c9
-rw-r--r--gcc/testsuite/c-c++-common/gomp/append-args-9.c7
-rw-r--r--gcc/testsuite/c-c++-common/gomp/append-args-interop.c44
-rw-r--r--gcc/testsuite/c-c++-common/gomp/dispatch-11.c3
-rw-r--r--gcc/testsuite/c-c++-common/gomp/interop-1.c80
-rw-r--r--gcc/testsuite/c-c++-common/gomp/interop-2.c64
-rw-r--r--gcc/testsuite/c-c++-common/gomp/interop-3.c26
-rw-r--r--gcc/testsuite/c-c++-common/gomp/interop-4.c8
-rw-r--r--gcc/testsuite/c-c++-common/gomp/metadirective-device.c2
-rw-r--r--gcc/testsuite/c-c++-common/gomp/metadirective-target-device-1.c2
-rw-r--r--gcc/testsuite/c-c++-common/gomp/metadirective-target-device-2.c2
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr118965-1.c57
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr118965-2.c31
-rw-r--r--gcc/testsuite/c-c++-common/musttail15.c2
-rw-r--r--gcc/testsuite/c-c++-common/musttail16.c2
-rw-r--r--gcc/testsuite/c-c++-common/musttail17.c2
-rw-r--r--gcc/testsuite/c-c++-common/musttail18.c2
-rw-r--r--gcc/testsuite/c-c++-common/musttail19.c7
-rw-r--r--gcc/testsuite/c-c++-common/musttail20.c2
-rw-r--r--gcc/testsuite/c-c++-common/musttail21.c2
-rw-r--r--gcc/testsuite/c-c++-common/musttail28.c108
-rw-r--r--gcc/testsuite/c-c++-common/musttail29.c109
-rw-r--r--gcc/testsuite/c-c++-common/musttail30.c109
-rw-r--r--gcc/testsuite/c-c++-common/musttail31.c109
-rw-r--r--gcc/testsuite/c-c++-common/musttail8.c5
-rw-r--r--gcc/testsuite/c-c++-common/pr118442.c17
-rw-r--r--gcc/testsuite/c-c++-common/pr119483-1.c29
-rw-r--r--gcc/testsuite/c-c++-common/pr119483-2.c12
-rw-r--r--gcc/testsuite/c-c++-common/pr119484.c21
-rw-r--r--gcc/testsuite/c-c++-common/pr119535.c31
-rw-r--r--gcc/testsuite/c-c++-common/pr119537-1.c23
-rw-r--r--gcc/testsuite/c-c++-common/pr119537-2.c23
-rw-r--r--gcc/testsuite/c-c++-common/pr119614-1.c28
-rw-r--r--gcc/testsuite/c-c++-common/pr119614-2.c28
-rw-r--r--gcc/testsuite/c-c++-common/pr119614-3.c28
-rw-r--r--gcc/testsuite/c-c++-common/pr119616.c23
-rw-r--r--gcc/testsuite/c-c++-common/pr119618.c21
40 files changed, 961 insertions, 141 deletions
diff --git a/gcc/testsuite/c-c++-common/goacc/pr69916.c b/gcc/testsuite/c-c++-common/goacc/pr69916.c
index e037af34..5c46bb7 100644
--- a/gcc/testsuite/c-c++-common/goacc/pr69916.c
+++ b/gcc/testsuite/c-c++-common/goacc/pr69916.c
@@ -1,4 +1,4 @@
-/* { dg-additional-options "-O2" } */
+/* { dg-additional-options "-O2" } */
/* PR 69916, an loop determined to be empty sometime after omp-lower
and before oacc-device-lower can evaporate leading to no GOACC_LOOP
diff --git a/gcc/testsuite/c-c++-common/gomp/append-args-1.c b/gcc/testsuite/c-c++-common/gomp/append-args-1.c
index 2a47063..e8561a57 100644
--- a/gcc/testsuite/c-c++-common/gomp/append-args-1.c
+++ b/gcc/testsuite/c-c++-common/gomp/append-args-1.c
@@ -23,25 +23,19 @@ float base0();
float repl1(omp_interop_t, omp_interop_t);
#pragma omp declare variant(repl1) match(construct={dispatch}) append_args(interop(target), interop(targetsync))
float base1();
-/* { dg-message "sorry, unimplemented: 'append_args' clause not yet supported for 'repl1', except when specifying all 2 objects in the 'interop' clause of the 'dispatch' directive" "" { target c } .-2 } */
-/* { dg-message "sorry, unimplemented: 'append_args' clause not yet supported for 'float repl1\\(omp_interop_t, omp_interop_t\\)', except when specifying all 2 objects in the 'interop' clause of the 'dispatch' directive" "" { target c++ } .-3 } */
void repl2(int *, int *, omp_interop_t, omp_interop_t);
#pragma omp declare variant(repl2) match(construct={dispatch}) adjust_args(need_device_ptr : y) \
append_args(interop(target, targetsync, prefer_type(1)), \
- interop(prefer_type({fr(3), attr("ompx_nop")},{fr(2)},{attr("ompx_all")})))
+ interop(target, prefer_type({fr(3), attr("ompx_nop")},{fr(2)},{attr("ompx_all")})))
void base2(int *x, int *y);
-/* { dg-message "sorry, unimplemented: 'append_args' clause not yet supported for 'repl2', except when specifying all 2 objects in the 'interop' clause of the 'dispatch' directive" "" { target c } .-3 } */
-/* { dg-message "sorry, unimplemented: 'append_args' clause not yet supported for 'void repl2\\(int\\*, int\\*, omp_interop_t, omp_interop_t\\)', except when specifying all 2 objects in the 'interop' clause of the 'dispatch' directive" "" { target c++ } .-4 } */
void repl3(int, omp_interop_t, ...);
#pragma omp declare variant(repl3) match(construct={dispatch}) \
- append_args(interop(prefer_type("cuda", "hsa")))
+ append_args(interop(target, prefer_type("cuda", "hsa")))
void base3(int, ...);
-/* { dg-message "sorry, unimplemented: 'append_args' clause not yet supported for 'repl3', except when specifying all 1 objects in the 'interop' clause of the 'dispatch' directive" "" { target c } .-2 } */
-/* { dg-message "sorry, unimplemented: 'append_args' clause not yet supported for 'void repl3\\(int, omp_interop_t, \\.\\.\\.\\)', except when specifying all 1 objects in the 'interop' clause of the 'dispatch' directive" "" { target c++ } .-3 } */
-/* { dg-note "'declare variant' candidate 'repl3' declared here" "" { target c } .-4 } */
-/* { dg-note "'declare variant' candidate 'void repl3\\(int, omp_interop_t, \\.\\.\\.\\)' declared here" "" { target c++ } .-5 } */
+/* { dg-note "'declare variant' candidate 'repl3' declared here" "" { target c } .-2 } */
+/* { dg-note "'declare variant' candidate 'void repl3\\(int, omp_interop_t, \\.\\.\\.\\)' declared here" "" { target c++ } .-3 } */
float repl4(short, short, omp_interop_t, short);
#pragma omp declare variant(repl4) match(construct={dispatch}) append_args(interop(target)) append_args(interop(targetsync)) /* { dg-error "too many 'append_args' clauses" } */
@@ -75,15 +69,12 @@ test (int *a, int *b)
#pragma omp dispatch interop ( obj1 )
x = base1 ();
- /* { dg-note "required by 'dispatch' construct" "" { target *-*-* } .-2 } */
#pragma omp dispatch interop ( obj1 )
base2 (a, b);
- /* { dg-note "required by 'dispatch' construct" "" { target *-*-* } .-2 } */
#pragma omp dispatch
base3 (5, 1, 2, 3);
- /* { dg-note "required by 'dispatch' construct" "" { target *-*-* } .-2 } */
#pragma omp dispatch interop (obj2)
base3 (5, 1, 2, 3);
@@ -92,7 +83,6 @@ test (int *a, int *b)
base3 (5, 1, 2, 3);
/* { dg-error "number of list items in 'interop' clause \\(2\\) exceeds the number of 'append_args' items \\(1\\) for 'declare variant' candidate 'repl3'" "" { target c } .-2 } */
/* { dg-error "number of list items in 'interop' clause \\(2\\) exceeds the number of 'append_args' items \\(1\\) for 'declare variant' candidate 'void repl3\\(int, omp_interop_t, \\.\\.\\.\\)'" "" { target c++ } .-3 } */
- /* { dg-note "required by 'dispatch' construct" "" { target *-*-* } .-4 } */
return x;
}
diff --git a/gcc/testsuite/c-c++-common/gomp/append-args-7.c b/gcc/testsuite/c-c++-common/gomp/append-args-7.c
index b7dff8a..d8a853e 100644
--- a/gcc/testsuite/c-c++-common/gomp/append-args-7.c
+++ b/gcc/testsuite/c-c++-common/gomp/append-args-7.c
@@ -20,14 +20,14 @@ void g1(...) { }
void f2(...) { }
/* { dg-error "argument 1 of 'f2' must be of 'omp_interop_t'" "" { target c } .-1 } */
/* { dg-error "argument 1 of 'void f2\\(\\.\\.\\.\\)' must be of 'omp_interop_t'" "" { target c++ } .-2 } */
-#pragma omp declare variant(f2) append_args(interop(target), interop(prefer_type("cuda"))) \
+#pragma omp declare variant(f2) append_args(interop(target), interop(target, prefer_type("cuda"))) \
match(construct={dispatch})
void g2(...) { }
/* { dg-note "'append_args' specified here" "" { target *-*-* } .-3 } */
void f3(omp_interop_t, omp_interop_t, ...) { }
-#pragma omp declare variant(f3) append_args(interop(target), interop(prefer_type("cuda"))) \
+#pragma omp declare variant(f3) append_args(interop(target), interop(target, prefer_type("cuda"))) \
match(construct={dispatch})
void g3(...) { }
diff --git a/gcc/testsuite/c-c++-common/gomp/append-args-8.c b/gcc/testsuite/c-c++-common/gomp/append-args-8.c
index fb442db..d47faa2 100644
--- a/gcc/testsuite/c-c++-common/gomp/append-args-8.c
+++ b/gcc/testsuite/c-c++-common/gomp/append-args-8.c
@@ -14,14 +14,15 @@ typedef enum omp_interop_t __GOMP_UINTPTR_T_ENUM
void f1(omp_interop_t) { }
#pragma omp declare variant(f1) match(construct={dispatch}) \
- append_args(interop(prefer_type({attr("ompx_fun")})))
+ append_args(interop(target, prefer_type({attr("ompx_fun")})))
void g1(void);
int f2(omp_interop_t, omp_interop_t);
-#pragma omp declare variant(f2) append_args(interop(prefer_type("cuda")), \
- interop(prefer_type({fr("hsa")}),target)) \
- match(construct={dispatch})
+#pragma omp declare variant(f2) \
+ append_args(interop(target, prefer_type("cuda")), \
+ interop(prefer_type({fr("hsa")}),target)) \
+ match(construct={dispatch})
int g2(void) { return 5; }
int foo (omp_interop_t obj1)
diff --git a/gcc/testsuite/c-c++-common/gomp/append-args-9.c b/gcc/testsuite/c-c++-common/gomp/append-args-9.c
index b8586e0..810ab36 100644
--- a/gcc/testsuite/c-c++-common/gomp/append-args-9.c
+++ b/gcc/testsuite/c-c++-common/gomp/append-args-9.c
@@ -14,14 +14,15 @@ void f1(omp_interop_t *) { }
/* { dg-error "argument 1 of 'f1' must be of 'omp_interop_t'" "" { target c } .-1 } */
/* { dg-note "initializing argument 1 of 'void f1\\(omp_interop_t\\*\\)'" "" { target c++ } .-2 } */
#pragma omp declare variant(f1) match(construct={dispatch}) \
- append_args(interop(prefer_type({attr("ompx_fun")})))
+ append_args(interop(targetsync, prefer_type({attr("ompx_fun")})))
void g1(void);
/* { dg-note "'append_args' specified here" "" { target c } .-2 } */
/* { dg-error "cannot convert 'omp_interop_t' to 'omp_interop_t\\*'" "" { target c++ } .-4 } */
int f2(omp_interop_t);
-#pragma omp declare variant(f2) append_args(interop(prefer_type("cuda"))) \
- match(construct={dispatch})
+#pragma omp declare variant(f2) \
+ append_args(interop(targetsync, prefer_type("cuda"))) \
+ match(construct={dispatch})
int g2(void) { return 5; }
int foo (omp_interop_t *obj1)
diff --git a/gcc/testsuite/c-c++-common/gomp/append-args-interop.c b/gcc/testsuite/c-c++-common/gomp/append-args-interop.c
new file mode 100644
index 0000000..1211450
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/append-args-interop.c
@@ -0,0 +1,44 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fdump-tree-gimple" } */
+
+/* Test that interop objects are implicitly created/destroyed when a dispatch
+ construct doesn't provide enough of them to satisfy the declare variant
+ append_args clause. */
+
+/* The following definitions are in omp_lib, which cannot be included
+ in gcc/testsuite/ */
+
+#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;
+
+float repl1(omp_interop_t, omp_interop_t, omp_interop_t);
+
+#pragma omp declare variant(repl1) match(construct={dispatch}) append_args(interop(target), interop(targetsync), interop (target))
+float base1(void);
+
+float
+test (int *a, int *b)
+{
+ omp_interop_t obj1;
+ float x;
+
+ /* repl1 takes 3 interop arguments, one will come from the dispatch
+ construct and the other 2 will be consed up. */
+ #pragma omp dispatch interop ( obj1 )
+ x = base1 ();
+
+ return x;
+}
+
+/* { dg-final { scan-tree-dump "__builtin_GOMP_interop \\(D\.\[0-9\]+, 2, interopobjs\.\[0-9\]+, tgt_tgtsync\.\[0-9\]+," "gimple" } } */
+/* { dg-final { scan-tree-dump "__builtin_GOMP_interop \\(D\.\[0-9\]+, 0, 0B, 0B, 0B, 0, 0B, 2, interopobjs\.\[0-9\]+," "gimple" } } */
+/* { dg-final { scan-tree-dump "repl1 \\(obj1, interop\.\[0-9\]+, interop\.\[0-9\]+\\)" "gimple" } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/dispatch-11.c b/gcc/testsuite/c-c++-common/gomp/dispatch-11.c
index e59985a..79dcd0a 100644
--- a/gcc/testsuite/c-c++-common/gomp/dispatch-11.c
+++ b/gcc/testsuite/c-c++-common/gomp/dispatch-11.c
@@ -87,12 +87,9 @@ test (int *a, int *b)
base3 (a, b);
/* { dg-error "number of list items in 'interop' clause \\(2\\) exceeds the number of 'append_args' items \\(1\\) for 'declare variant' candidate 'repl3'" "" { target c } .-2 } */
/* { dg-error "number of list items in 'interop' clause \\(2\\) exceeds the number of 'append_args' items \\(1\\) for 'declare variant' candidate 'void repl3\\(int\\*, int\\*, omp_interop_t\\)'" "" { target c++ } .-3 } */
- /* { dg-note "required by 'dispatch' construct" "" { target *-*-* } .-4 } */
#pragma omp dispatch interop(obj3)
base3 (a, b);
- /* { dg-message "sorry, unimplemented: 'append_args' clause not yet supported for 'repl3'" "" { target c } 28 } */
- /* { dg-message "sorry, unimplemented: 'append_args' clause not yet supported for 'void repl3\\(int\\*, int\\*, omp_interop_t\\)'" "" { target c++ } 28 } */
return x + y;
}
diff --git a/gcc/testsuite/c-c++-common/gomp/interop-1.c b/gcc/testsuite/c-c++-common/gomp/interop-1.c
index d68611b..2a81d4b 100644
--- a/gcc/testsuite/c-c++-common/gomp/interop-1.c
+++ b/gcc/testsuite/c-c++-common/gomp/interop-1.c
@@ -40,12 +40,12 @@ void f()
omp_interop_t obj1, obj2, obj3, obj4, obj5;
int x;
- #pragma omp interop init(obj1) init(target,targetsync : obj2, obj3) nowait // OK
- #pragma omp interop init(obj1) init (targetsync : obj2, obj3) nowait // OK
- #pragma omp interop init(obj1) init (targetsync , target : obj2, obj3) nowait // OK
+ #pragma omp interop init(targetsync: obj1) init(target,targetsync : obj2, obj3) nowait // OK
+ #pragma omp interop init(target: obj1) init (targetsync : obj2, obj3) nowait // OK
+ #pragma omp interop init(target: obj1) init (targetsync , target : obj2, obj3) nowait // OK
- #pragma omp interop init(obj1) init(target,targetsync,target: obj2, obj3) nowait // { dg-error "duplicate 'target' modifier" }
- #pragma omp interop init(obj1) init(target,targetsync, targetsync : obj2, obj3) nowait // { dg-error "duplicate 'targetsync' modifier" }
+ #pragma omp interop init(target: obj1) init(target,targetsync,target: obj2, obj3) nowait // { dg-error "duplicate 'target' modifier" }
+ #pragma omp interop init(target: obj1) init(target,targetsync, targetsync : obj2, obj3) nowait // { dg-error "duplicate 'targetsync' modifier" }
#pragma omp interop init(prefer_type("cuda", omp_ifr_opencl, omp_ifr_level_zero, "hsa"), targetsync : obj1) \
destroy(obj2, obj3) depend(inout: x) use(obj4, obj5) device(device_num: 0)
@@ -54,10 +54,10 @@ void f()
#pragma omp assume contains(interop)
{
- #pragma omp interop init(prefer_type("cuða") : obj3) // { dg-warning "unknown foreign runtime identifier 'cu\[^'\]*a'" }
+ #pragma omp interop init(target, prefer_type("cuða") : obj3) // { dg-warning "unknown foreign runtime identifier 'cu\[^'\]*a'" }
}
- #pragma omp interop init(prefer_type("cu\0da") : obj3) // { dg-error "string literal must not contain '\\\\0'" }
+#pragma omp interop init(target, prefer_type("cu\0da") : obj3) // { dg-error "string literal must not contain '\\\\0'" }
#pragma omp interop depend(inout: x) , use(obj2), destroy(obj3) // OK, use or destroy might have 'targetsync'
@@ -69,49 +69,47 @@ void f()
#pragma omp interop init ( target , prefer_type( { fr("hsa"), attr("ompx_nothing") , fr("hsa" ) }) :obj1) // { dg-error "duplicated 'fr' preference selector before '\\(' token" }
- #pragma omp interop init ( prefer_type( 4, omp_ifr_hip*4) : obj1) // { dg-warning "unknown foreign runtime identifier '20'" }
- #pragma omp interop init ( prefer_type( __builtin_sin(3.3) : obj1)
- // { dg-error "'prefer_type' undeclared \\(first use in this function\\)" "" { target c } .-1 }
- // { dg-error "'prefer_type' has not been declared" "" { target c++ } .-2 }
- // { dg-error "expected '\\)' before '\\(' token" "" { target *-*-* } .-3 }
-
- #pragma omp interop init ( prefer_type( __builtin_sin(3.3) ) : obj1) // { dg-error "expected string literal or constant integer expression before '\\)' token" }
- #pragma omp interop init ( prefer_type( {fr(4 ) }) : obj1) // OK
- #pragma omp interop init ( prefer_type( {fr("cu\0da" ) }) : obj1) // { dg-error "string literal must not contain '\\\\0'" }
- #pragma omp interop init ( prefer_type( {fr("cuda\0") }) : obj1) // { dg-error "string literal must not contain '\\\\0'" }
- #pragma omp interop init ( prefer_type( {fr("cuda" ) }) : obj1) // OK
- #pragma omp interop init ( prefer_type( {fr(omp_ifr_level_zero ) }, {fr(omp_ifr_hip)}) : obj1) // OK
- #pragma omp interop init ( prefer_type( {fr("cuda", "cuda_driver") }) : obj1) // { dg-error "53: expected '\\)' before ',' token" }
- #pragma omp interop init ( prefer_type( {fr(my_string) }) : obj1) // { dg-error "56: expected string literal or constant integer expression before '\\)' token" }
- #pragma omp interop init ( prefer_type( {fr("hello" }) : obj1) // { dg-error "expected '\\)' before '\\(' token" }
- // { dg-error "'prefer_type' has not been declared" "" { target c++ } .-1 }
- #pragma omp interop init ( prefer_type( {fr("hello") }) : obj1)
+ #pragma omp interop init (target, prefer_type( 4, omp_ifr_hip*4) : obj1) // { dg-warning "unknown foreign runtime identifier '20'" }
+ #pragma omp interop init (prefer_type( __builtin_sin(3.3), target : obj1)
+ // { dg-error "expected string literal or constant integer expression" "" { target *-*-* } .-1 }
+
+#pragma omp interop init (prefer_type( __builtin_sin(3.3)), target : obj1) // { dg-error "expected string literal or constant integer expression before '\\)' token" }
+ #pragma omp interop init (target, prefer_type( {fr(4 ) }) : obj1) // OK
+ #pragma omp interop init (target, prefer_type( {fr("cu\0da" ) }) : obj1) // { dg-error "string literal must not contain '\\\\0'" }
+ #pragma omp interop init (target, prefer_type( {fr("cuda\0") }) : obj1) // { dg-error "string literal must not contain '\\\\0'" }
+ #pragma omp interop init (target, prefer_type( {fr("cuda" ) }) : obj1) // OK
+ #pragma omp interop init (target, prefer_type( {fr(omp_ifr_level_zero ) }, {fr(omp_ifr_hip)}) : obj1) // OK
+ #pragma omp interop init (target, prefer_type( {fr("cuda", "cuda_driver") }) : obj1) // { dg-error "60: expected '\\)' before ',' token" }
+ #pragma omp interop init (target, prefer_type( {fr(my_string) }) : obj1) // { dg-error "63: expected string literal or constant integer expression before '\\)' token" }
+ #pragma omp interop init (target, prefer_type( {fr("hello" }) : obj1) // { dg-error "expected '\\)' before '\}' token" }
+ /* { dg-warning "unknown foreign runtime identifier 'hello' \\\[-Wopenmp\\\]" "" { target *-*-* } .-1 } */
+ #pragma omp interop init (target, prefer_type( {fr("hello") }) : obj1)
/* { dg-warning "unknown foreign runtime identifier 'hello' \\\[-Wopenmp\\\]" "" { target *-*-* } .-1 } */
- #pragma omp interop init ( prefer_type( {fr(x) }) : obj1) // { dg-error "expected string literal or constant integer expression before '\\)' token" }
+ #pragma omp interop init (target, prefer_type( {fr(x) }) : obj1) // { dg-error "expected string literal or constant integer expression before '\\)' token" }
- #pragma omp interop init ( prefer_type( {fr(ifr_scalar ) }) : obj1) // OK
- #pragma omp interop init ( prefer_type( {fr(ifr_array ) }) : obj1) // { dg-error "expected string literal or constant integer expression before '\\)' token" }
+ #pragma omp interop init (target, prefer_type( {fr(ifr_scalar ) }) : obj1) // OK
+ #pragma omp interop init (target, prefer_type( {fr(ifr_array ) }) : obj1) // { dg-error "expected string literal or constant integer expression before '\\)' token" }
// OK in C++, for C: constexpr arrays are not part of C23; however, they are/were under consideration for C2y.
- #pragma omp interop init ( prefer_type( {fr(ifr_array[0] ) }) : obj1)
+ #pragma omp interop init (target, prefer_type( {fr(ifr_array[0] ) }) : obj1)
// { dg-error "expected string literal or constant integer expression before '\\)' token" "" { target c } .-1 }
- #pragma omp interop init ( prefer_type( omp_ifr_level_zero, omp_ifr_hip ) : obj1) // OK
- #pragma omp interop init ( prefer_type( omp_ifr_level_zero +1 ) : obj1) // OK
- #pragma omp interop init ( prefer_type( x ) : obj1) // { dg-error "expected string literal or constant integer expression before '\\)' token" }
+ #pragma omp interop init (target, prefer_type( omp_ifr_level_zero, omp_ifr_hip ) : obj1) // OK
+ #pragma omp interop init (target, prefer_type( omp_ifr_level_zero +1 ) : obj1) // OK
+ #pragma omp interop init (target, prefer_type( x ) : obj1) // { dg-error "expected string literal or constant integer expression before '\\)' token" }
- #pragma omp interop init ( prefer_type( ifr_scalar ) : obj1) // OK
- #pragma omp interop init ( prefer_type( ifr_array ) : obj1) // { dg-error "expected string literal or constant integer expression before '\\)' token" }
+ #pragma omp interop init (target, prefer_type( ifr_scalar ) : obj1) // OK
+ #pragma omp interop init (target, prefer_type( ifr_array ) : obj1) // { dg-error "expected string literal or constant integer expression before '\\)' token" }
// OK in C++, for C: constexpr arrays are not part of C23; however, they are/were under consideration for C2y.
- #pragma omp interop init ( prefer_type( ifr_array[1] ) : obj1)
+ #pragma omp interop init (target, prefer_type( ifr_array[1] ) : obj1)
// { dg-error "expected string literal or constant integer expression before '\\)' token" "" { target c } .-1 }
- #pragma omp interop init ( prefer_type( 4, omp_ifr_hip*4) : obj1) // { dg-warning "unknown foreign runtime identifier '20'" }
- #pragma omp interop init ( prefer_type( 4, 1, 3) : obj1)
+ #pragma omp interop init (target, prefer_type( 4, omp_ifr_hip*4) : obj1) // { dg-warning "unknown foreign runtime identifier '20'" }
+ #pragma omp interop init (target, prefer_type( 4, 1, 3) : obj1)
- #pragma omp interop init ( prefer_type( {fr("cuda") }, {fr(omp_ifr_hsa)} , {attr("ompx_a") } , {fr(omp_ifr_hip) }) : obj1)
- #pragma omp interop init ( prefer_type( {fr("cuda") }, {fr(omp_ifr_hsa,omp_ifr_level_zero)} , {attr("ompx_a") } , {fr(omp_ifr_hip) }) : obj1) // { dg-error "73: expected '\\)' before ',' token" }
- #pragma omp interop init ( prefer_type( {fr("cuda",5) }, {fr(omp_ifr_hsa,omp_ifr_level_zero)} , {attr("ompx_a") } , {fr(omp_ifr_hip) }) : obj1) // { dg-error "53: expected '\\)' before ',' token" }
- #pragma omp interop init ( prefer_type( {fr("sycl"), attr("ompx_1", "ompx_2"), attr("ompx_3") }, {attr("ompx_4", "ompx_5"),fr(omp_ifr_level_zero)} ) : obj1)
- #pragma omp interop init ( prefer_type( { fr(5), attr("ompx_1") }, {fr(omp_ifr_hsa)} , {attr("ompx_a") } ) : obj1)
+ #pragma omp interop init (target, prefer_type( {fr("cuda") }, {fr(omp_ifr_hsa)} , {attr("ompx_a") } , {fr(omp_ifr_hip) }) : obj1)
+ #pragma omp interop init (target, prefer_type( {fr("cuda") }, {fr(omp_ifr_hsa,omp_ifr_level_zero)} , {attr("ompx_a") } , {fr(omp_ifr_hip) }) : obj1) // { dg-error "80: expected '\\)' before ',' token" }
+ #pragma omp interop init (target, prefer_type( {fr("cuda",5) }, {fr(omp_ifr_hsa,omp_ifr_level_zero)} , {attr("ompx_a") } , {fr(omp_ifr_hip) }) : obj1) // { dg-error "60: expected '\\)' before ',' token" }
+ #pragma omp interop init (target, prefer_type( {fr("sycl"), attr("ompx_1", "ompx_2"), attr("ompx_3") }, {attr("ompx_4", "ompx_5"),fr(omp_ifr_level_zero)} ) : obj1)
+ #pragma omp interop init (target, prefer_type( { fr(5), attr("ompx_1") }, {fr(omp_ifr_hsa)} , {attr("ompx_a") } ) : obj1)
}
diff --git a/gcc/testsuite/c-c++-common/gomp/interop-2.c b/gcc/testsuite/c-c++-common/gomp/interop-2.c
index af81cc6..3e6ed81 100644
--- a/gcc/testsuite/c-c++-common/gomp/interop-2.c
+++ b/gcc/testsuite/c-c++-common/gomp/interop-2.c
@@ -41,18 +41,18 @@ void f(const omp_interop_t ocp)
short o2;
float of;
- #pragma omp interop init (ocp) // { dg-error "'ocp' shall not be const" }
- #pragma omp interop init (oce) // { dg-error "'oce' shall not be const" }
- #pragma omp interop init (occ) // { dg-error "'occ' shall not be const" }
- #pragma omp interop init (od) // { dg-error "'od' must be of 'omp_interop_t'" }
- #pragma omp interop init (od[1])// { dg-error "expected '\\)' before '\\\[' token" }
+ #pragma omp interop init (targetsync: ocp) // { dg-error "'ocp' shall not be const" }
+ #pragma omp interop init (targetsync: oce) // { dg-error "'oce' shall not be const" }
+ #pragma omp interop init (targetsync: occ) // { dg-error "'occ' shall not be const" }
+ #pragma omp interop init (targetsync: od) // { dg-error "'od' must be of 'omp_interop_t'" }
+ #pragma omp interop init (targetsync: od[1])// { dg-error "expected '\\)' before '\\\[' token" }
// { dg-error "'od' must be of 'omp_interop_t'" "" { target *-*-* } .-1 }
- #pragma omp interop init (op) // { dg-error "'op' must be of 'omp_interop_t'" }
- #pragma omp interop init (*op)
+ #pragma omp interop init (targetsync: op) // { dg-error "'op' must be of 'omp_interop_t'" }
+ #pragma omp interop init (targetsync: *op)
// { dg-error "expected identifier before '\\*' token" "" { target c } .-1 }
// { dg-error "expected unqualified-id before '\\*' token" "" { target c++ } .-2 }
- #pragma omp interop init (o2) // { dg-error "'o2' must be of 'omp_interop_t'" }
- #pragma omp interop init (of) // { dg-error "'of' must be of 'omp_interop_t'" }
+ #pragma omp interop init (targetsync: o2) // { dg-error "'o2' must be of 'omp_interop_t'" }
+ #pragma omp interop init (targetsync: of) // { dg-error "'of' must be of 'omp_interop_t'" }
#pragma omp interop use (ocp) // OK
#pragma omp interop use (oce) // odd but okay
@@ -86,40 +86,26 @@ void g()
omp_interop_t obj1, obj2, obj3, obj4, obj5;
int x;
- #pragma omp interop init ( prefer_type( {fr("") }) : obj1) // { dg-error "non-empty string literal expected before '\\)' token" }
- #pragma omp interop init ( prefer_type( {fr("hip") , attr(omp_ifr_cuda) }) : obj1) ! { dg-error "expected string literal before 'omp_ifr_cuda'" }
+ #pragma omp interop init (target, prefer_type( {fr("") }) : obj1) // { dg-error "non-empty string literal expected before '\\)' token" }
+ #pragma omp interop init (target, prefer_type( {fr("hip") , attr(omp_ifr_cuda) }) : obj1) ! { dg-error "expected string literal before 'omp_ifr_cuda'" }
- #pragma omp interop init ( prefer_type( {fr("hip") , attr("myooption") }) : obj1) // { dg-error "'attr' string literal must start with 'ompx_'" }
- #pragma omp interop init ( prefer_type( {fr("hip") , attr("ompx_option") , attr("ompx_") } ) : obj1)
- #pragma omp interop init ( prefer_type( {fr("hip") , attr("ompx_option") }, { attr("ompx_") } ) : obj1)
- #pragma omp interop init ( prefer_type( {fr("hip") , attr("ompx_option") } { attr("ompx_") } ) : obj1) // { dg-error "expected '\\)' or ',' before '\{' token" }
- #pragma omp interop init ( prefer_type( {fr("hip") , attr("ompx_option") ) : obj1)
- // { dg-error "expected ',' or '\}' before '\\)' token" "" { target c } .-1 }
- // { dg-error "prefer_type' has not been declared" "" { target c++ } .-2 }
- // { dg-error "expected '\\)' before '\\(' token" "" { target c++ } .-3 }
+ #pragma omp interop init (target, prefer_type( {fr("hip") , attr("myooption") }) : obj1) // { dg-error "'attr' string literal must start with 'ompx_'" }
+ #pragma omp interop init (target, prefer_type( {fr("hip") , attr("ompx_option") , attr("ompx_") } ) : obj1)
+ #pragma omp interop init (target, prefer_type( {fr("hip") , attr("ompx_option") }, { attr("ompx_") } ) : obj1)
+ #pragma omp interop init (target, prefer_type( {fr("hip") , attr("ompx_option") } { attr("ompx_") } ) : obj1) // { dg-error "expected '\\)' or ',' before '\{' token" }
+ #pragma omp interop init (target, prefer_type( {fr("hip") , attr("ompx_option") ) : obj1) // { dg-error "expected ',' or '\}' before '\\)' token" }
- #pragma omp interop init ( prefer_type( {fr("hip") attr("ompx_option") ) : obj1)
- // { dg-error "expected ',' or '\}' before 'attr'" "" { target c } .-1 }
- // { dg-error "prefer_type' has not been declared" "" { target c++ } .-2 }
- // { dg-error "expected '\\)' before '\\(' token" "" { target c++ } .-3 }
- #pragma omp interop init ( prefer_type( {fr("hip")}), prefer_type("cuda") : obj1) // { dg-error "duplicate 'prefer_type' modifier" }
+ #pragma omp interop init (target, prefer_type( {fr("hip") attr("ompx_option") ) : obj1) // { dg-error "expected ',' or '\}' before 'attr'" }
+ #pragma omp interop init (target, prefer_type( {fr("hip")}), prefer_type("cuda") : obj1) // { dg-error "duplicate 'prefer_type' modifier" }
- #pragma omp interop init ( prefer_type( {attr("ompx_option1,ompx_option2") } ) : obj1) // { dg-error "'attr' string literal must not contain a comma" }
+ #pragma omp interop init (target, prefer_type( {attr("ompx_option1,ompx_option2") } ) : obj1) // { dg-error "'attr' string literal must not contain a comma" }
- #pragma omp interop init ( prefer_type( {attr("ompx_option1,ompx_option2") ) : obj1)
- // { dg-error "'attr' string literal must not contain a comma" "" { target c } .-1 }
- // { dg-error "prefer_type' has not been declared" "" { target c++ } .-2 }
- // { dg-error "expected '\\)' before '\\(' token" "" { target c++ } .-3 }
+ #pragma omp interop init (target, prefer_type( {attr("ompx_option1,ompx_option2") ) : obj1) // { dg-error "'attr' string literal must not contain a comma" }
#pragma omp interop init ( targetsync other ) : obj1)
- // { dg-error "'targetsync' undeclared \\(first use in this function\\)" "" { target c } .-1 }
- // { dg-error "'targetsync' has not been declared" "" { target c++ } .-2 }
- // { dg-error "expected '\\)' before 'other'" "" { target *-*-* } .-3 }
- // { dg-error "expected an OpenMP clause before ':' token" "" { target *-*-* } .-4 }
-
- #pragma omp interop init ( prefer_type( {fr("cuda") } ), other : obj1) // { dg-error "'init' clause with modifier other than 'prefer_type', 'target' or 'targetsync' before 'other'" }
- #pragma omp interop init ( prefer_type( {fr("cuda") } ), obj1)
- // { dg-error "'prefer_type' undeclared \\(first use in this function\\)" "" { target c } .-1 }
- // { dg-error "'prefer_type' has not been declared" "" { target c++ } .-2 }
- // { dg-error "expected '\\)' before '\\(' token" "" { target *-*-* } .-3 }
+ // { dg-error "expected an OpenMP clause before ':' token" "" { target *-*-* } .-1 }
+ // { dg-error "expected ':' before 'other'" "" { target *-*-* } .-2 }
+
+ #pragma omp interop init (target, prefer_type( {fr("cuda") } ), other : obj1) // { dg-error "expected 'prefer_type', 'target', or 'targetsync'" }
+ #pragma omp interop init (prefer_type( {fr("cuda") } ), obj1) // { dg-error "expected 'prefer_type', 'target', or 'targetsync'" }
}
diff --git a/gcc/testsuite/c-c++-common/gomp/interop-3.c b/gcc/testsuite/c-c++-common/gomp/interop-3.c
index 51d26dd..38d7f65 100644
--- a/gcc/testsuite/c-c++-common/gomp/interop-3.c
+++ b/gcc/testsuite/c-c++-common/gomp/interop-3.c
@@ -34,17 +34,17 @@ void f()
omp_interop_t target, targetsync, prefer_type;
int x;
- #pragma omp interop init(obj1) init(target,targetsync : obj2, obj3) nowait
+#pragma omp interop init(target: obj1) init(target,targetsync : obj2, obj3) nowait
#pragma omp interop init(prefer_type("cuda", omp_ifr_opencl, omp_ifr_level_zero, "hsa"), targetsync : obj1) \
destroy(obj2, obj3) depend(inout: x) use(obj4, obj5) device(device_num: 0)
#pragma omp assume contains(interop)
{
- #pragma omp interop init(prefer_type("cu da") : obj3) // { dg-warning "unknown foreign runtime identifier 'cu da'" }
+ #pragma omp interop init(prefer_type("cu da"), targetsync : obj3) // { dg-warning "unknown foreign runtime identifier 'cu da'" }
}
- #pragma omp interop init(obj1, obj2, obj1), use(obj4) destroy(obj4)
+ #pragma omp interop init(target: obj1, obj2, obj1), use(obj4) destroy(obj4)
// { dg-error "'obj4' appears more than once in action clauses" "" { target *-*-* } .-1 }
// { dg-error "'obj1' appears more than once in action clauses" "" { target *-*-* } .-2 }
@@ -54,27 +54,21 @@ void f()
#pragma omp interop depend(inout: x) use(obj2), destroy(obj3) // Likewise
- #pragma omp interop depend(inout: x) use(obj2), destroy(obj3) init(obj4) // { dg-error "'depend' clause requires action clauses with 'targetsync' interop-type" }
+ #pragma omp interop depend(inout: x) use(obj2), destroy(obj3) init(target: obj4) // { dg-error "'depend' clause requires action clauses with 'targetsync' interop-type" }
// { dg-note "69: 'init' clause lacks the 'targetsync' modifier" "" { target c } .-1 }
- // { dg-note "70: 'init' clause lacks the 'targetsync' modifier" "" { target c++ } .-2 }
+ // { dg-note "78: 'init' clause lacks the 'targetsync' modifier" "" { target c++ } .-2 }
- #pragma omp interop depend(inout: x) init(targetsync : obj5) use(obj2), destroy(obj3) init(obj4) // { dg-error "'depend' clause requires action clauses with 'targetsync' interop-type" }
+ #pragma omp interop depend(inout: x) init(targetsync : obj5) use(obj2), destroy(obj3) init(target : obj4) // { dg-error "'depend' clause requires action clauses with 'targetsync' interop-type" }
// { dg-note "'init' clause lacks the 'targetsync' modifier" "" { target *-*-* } .-1 }
#pragma omp interop depend(inout: x) init(targetsync : obj5) use(obj2), destroy(obj3) init(prefer_type("cuda"), targetsync : obj4) // OK
- #pragma omp interop init(target, targetsync, prefer_type, obj1)
- #pragma omp interop init(prefer_type, obj1, target, targetsync)
+ #pragma omp interop init(target, targetsync, prefer_type, obj1) // { dg-error "59: expected '\\(' before ',' token" }
+ #pragma omp interop init(prefer_type, obj1, target, targetsync) // { dg-error "39: expected '\\(' before ',' token" }
// Duplicated variable name or duplicated modifier:
#pragma omp interop init(target, targetsync,target : obj1) // { dg-error "duplicate 'target' modifier" }
- #pragma omp interop init(target, targetsync,target) // { dg-error "'target' appears more than once in action clauses" }
+#pragma omp interop init(target, targetsync,target: obj1) // { dg-error "duplicate 'target' modifier" }
#pragma omp interop init(target : target, targetsync,target) // { dg-error "'target' appears more than once in action clauses" }
- #pragma omp interop init(target, targetsync,targetsync : obj1) // { dg-error "duplicate 'targetsync' modifier" }
- #pragma omp interop init(target, targetsync,targetsync) // { dg-error "targetsync' appears more than once in action clause" }
- #pragma omp interop init(target : target, targetsync,targetsync) // { dg-error "targetsync' appears more than once in action clause" }
-
- #pragma omp interop init(, targetsync, prefer_type, obj1, target)
- // { dg-error "expected identifier before ',' token" "" { target c } .-1 }
- // { dg-error "expected unqualified-id before ',' token" "" { target c++ } .-2 }
+ #pragma omp interop init(, targetsync, prefer_type, obj1, target) // { dg-error "expected 'prefer_type', 'target', or 'targetsync'" }
}
diff --git a/gcc/testsuite/c-c++-common/gomp/interop-4.c b/gcc/testsuite/c-c++-common/gomp/interop-4.c
index bb0bf31..a6449f1 100644
--- a/gcc/testsuite/c-c++-common/gomp/interop-4.c
+++ b/gcc/testsuite/c-c++-common/gomp/interop-4.c
@@ -33,14 +33,14 @@ f()
omp_interop_t obj1, obj2, obj3, obj4, obj5, obj6, obj7;
int x[6];
- #pragma omp interop init ( obj1, obj2) use (obj3) destroy(obj4) init(obj5) destroy(obj6) use(obj7)
- /* { dg-final { scan-tree-dump-times "#pragma omp interop use\\(obj7\\) destroy\\(obj6\\) init\\(obj5\\) destroy\\(obj4\\) use\\(obj3\\) init\\(obj2\\) init\\(obj1\\)\[\r\n\]" 1 "original" } } */
+#pragma omp interop init (target: obj1, obj2) use (obj3) destroy(obj4) init(targetsync: obj5) destroy(obj6) use(obj7)
+ /* { dg-final { scan-tree-dump-times "#pragma omp interop use\\(obj7\\) destroy\\(obj6\\) init\\(targetsync: obj5\\) destroy\\(obj4\\) use\\(obj3\\) init\\(target: obj2\\) init\\(target: obj1\\)\[\r\n\]" 1 "original" } } */
#pragma omp interop nowait init (targetsync : obj1, obj2) use (obj3) destroy(obj4) init(target, targetsync : obj5) destroy(obj6) use(obj7) depend(inout: x)
/* { dg-final { scan-tree-dump-times "#pragma omp interop depend\\(inout:x\\) use\\(obj7\\) destroy\\(obj6\\) init\\(target, targetsync: obj5\\) destroy\\(obj4\\) use\\(obj3\\) init\\(targetsync: obj2\\) init\\(targetsync: obj1\\) nowait\[\r\n\]" 1 "original" } } */
- #pragma omp interop init ( obj1, obj2) init (target: obj3) init(targetsync : obj4) init(target,targetsync: obj5)
- /* { dg-final { scan-tree-dump-times "#pragma omp interop init\\(target, targetsync: obj5\\) init\\(targetsync: obj4\\) init\\(target: obj3\\) init\\(obj2\\) init\\(obj1\\)\[\r\n\]" 1 "original" } } */
+#pragma omp interop init (target: obj1, obj2) init (target: obj3) init(targetsync : obj4) init(target,targetsync: obj5)
+ /* { dg-final { scan-tree-dump-times "#pragma omp interop init\\(target, targetsync: obj5\\) init\\(targetsync: obj4\\) init\\(target: obj3\\) init\\(target: obj2\\) init\\(target: obj1\\)\[\r\n\]" 1 "original" } } */
/* -------------------------------------------- */
diff --git a/gcc/testsuite/c-c++-common/gomp/metadirective-device.c b/gcc/testsuite/c-c++-common/gomp/metadirective-device.c
index 3807624..d7f736d 100644
--- a/gcc/testsuite/c-c++-common/gomp/metadirective-device.c
+++ b/gcc/testsuite/c-c++-common/gomp/metadirective-device.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-additional-options "-foffload=disable -fdump-tree-optimized" } */
-/* { dg-additional-options "-DDEVICE_ARCH=x86_64 -DDEVICE_ISA=sse -msse" { target { x86_64-*-* && { ! ia32 } } } } */
+/* { dg-additional-options "-DDEVICE_ARCH=x86_64 -DDEVICE_ISA=sse -msse" { target { x86 && lp64 } } } */
#include <stdlib.h>
diff --git a/gcc/testsuite/c-c++-common/gomp/metadirective-target-device-1.c b/gcc/testsuite/c-c++-common/gomp/metadirective-target-device-1.c
index 5d3a4c3..284f35f 100644
--- a/gcc/testsuite/c-c++-common/gomp/metadirective-target-device-1.c
+++ b/gcc/testsuite/c-c++-common/gomp/metadirective-target-device-1.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-additional-options "-fdump-tree-optimized" } */
-/* { dg-additional-options "-DDEVICE_ARCH=x86_64 -DDEVICE_ISA=mmx -mmmx" { target { x86_64-*-* && { ! ia32 } } } } */
+/* { dg-additional-options "-DDEVICE_ARCH=x86_64 -DDEVICE_ISA=mmx -mmmx" { target { x86 && lp64 } } } */
#include <stdlib.h>
diff --git a/gcc/testsuite/c-c++-common/gomp/metadirective-target-device-2.c b/gcc/testsuite/c-c++-common/gomp/metadirective-target-device-2.c
index 24584f2..4de1921 100644
--- a/gcc/testsuite/c-c++-common/gomp/metadirective-target-device-2.c
+++ b/gcc/testsuite/c-c++-common/gomp/metadirective-target-device-2.c
@@ -1,4 +1,4 @@
-/* { dg-do compile */
+/* { dg-do compile } */
/* { dg-additional-options "-fdump-tree-optimized" } */
/* In configurations without offloading configured, we can resolve many
diff --git a/gcc/testsuite/c-c++-common/gomp/pr118965-1.c b/gcc/testsuite/c-c++-common/gomp/pr118965-1.c
new file mode 100644
index 0000000..2014b94
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr118965-1.c
@@ -0,0 +1,57 @@
+/* { dg-do compile } */
+
+/* At least one of the target and/or targetsync modifiers must be provided.
+ This implies that there are always modifiers required, and the parser
+ should reject e.g. "init (var1, var2)"; the first thing in the list is
+ always an init_modifier in valid code. */
+
+/* The following definitions are in omp_lib, which cannot be included
+ in gcc/testsuite/ */
+
+#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;
+
+typedef enum omp_interop_fr_t
+{
+ omp_ifr_cuda = 1,
+ omp_ifr_cuda_driver = 2,
+ omp_ifr_opencl = 3,
+ omp_ifr_sycl = 4,
+ omp_ifr_hip = 5,
+ omp_ifr_level_zero = 6,
+ omp_ifr_hsa = 7,
+ omp_ifr_last = omp_ifr_hsa
+} omp_interop_fr_t;
+
+// ---------------------------------
+
+void f()
+{
+ omp_interop_t obj1, obj2;
+
+ #pragma omp interop init (obj1) // { dg-error "expected 'prefer_type', 'target', or 'targetsync'" }
+ #pragma omp interop init (obj1, obj2) // { dg-error "expected 'prefer_type', 'target', or 'targetsync'" }
+ #pragma omp interop init (obj1, target) // { dg-error "expected 'prefer_type', 'target', or 'targetsync'" }
+ #pragma omp interop init (target, obj1) // { dg-error "expected 'prefer_type', 'target', or 'targetsync'" }
+ #pragma omp interop init (obj1, targetsync) // { dg-error "expected 'prefer_type', 'target', or 'targetsync'" }
+ #pragma omp interop init (targetsync, obj1) // { dg-error "expected 'prefer_type', 'target', or 'targetsync'" }
+ #pragma omp interop init (targetsync, target) // { dg-error "expected ':' before '\\)' token" }
+
+ #pragma omp interop init (target, prefer_type( {fr(4 ) }) : obj1) // OK
+ #pragma omp interop init (targetsync, prefer_type( {fr(4 ) }) : obj1) // OK
+ #pragma omp interop init (prefer_type( {fr(4 ) }), target : obj1) // OK
+
+ #pragma omp interop init (prefer_type( {fr(4 ) }) : obj1) // { dg-error "missing required 'target' and/or 'targetsync' modifier" }
+ #pragma omp interop init (prefer_type( {fr(4 ) }) : foobar) // { dg-error "missing required 'target' and/or 'targetsync' modifier" }
+ // { dg-error "'foobar' undeclared" "" { target c } .-1 }
+ // { dg-error "'foobar' has not been declared" "" { target c++ } .-2 }
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/pr118965-2.c b/gcc/testsuite/c-c++-common/gomp/pr118965-2.c
new file mode 100644
index 0000000..6e27179
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr118965-2.c
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+
+/* At least one of the target and/or targetsync modifiers must be provided. */
+
+#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 f1(omp_interop_t) { }
+#pragma omp declare variant(f1) match(construct={dispatch}) \
+ append_args(interop(prefer_type({attr("ompx_fun")})))
+// { dg-error "missing required 'target' and/or 'targetsync' modifier" "" { target *-*-* } .-1 }
+void g1(void);
+
+
+int f2(omp_interop_t, omp_interop_t);
+#pragma omp declare variant(f2) \
+ append_args(interop(prefer_type("cuda")), \
+ interop(prefer_type({fr("hsa")}))) \
+ match(construct={dispatch})
+// { dg-error "missing required 'target' and/or 'targetsync' modifier" "" { target *-*-* } .-3 }
+// { dg-error "missing required 'target' and/or 'targetsync' modifier" "" { target *-*-* } .-3 }
+int g2(void) { return 5; }
diff --git a/gcc/testsuite/c-c++-common/musttail15.c b/gcc/testsuite/c-c++-common/musttail15.c
index 2addc97..b8223d7 100644
--- a/gcc/testsuite/c-c++-common/musttail15.c
+++ b/gcc/testsuite/c-c++-common/musttail15.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { musttail && { c || c++11 } } } } */
+/* { dg-do compile { target musttail } } */
/* { dg-additional-options "-fdelayed-branch" { target sparc*-*-* } } */
int __attribute__((noinline,noclone,noipa))
diff --git a/gcc/testsuite/c-c++-common/musttail16.c b/gcc/testsuite/c-c++-common/musttail16.c
index b1e2ff3..f27a279 100644
--- a/gcc/testsuite/c-c++-common/musttail16.c
+++ b/gcc/testsuite/c-c++-common/musttail16.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { musttail && { c || c++11 } } } } */
+/* { dg-do compile { target musttail } } */
struct box { char field[256]; int i; };
diff --git a/gcc/testsuite/c-c++-common/musttail17.c b/gcc/testsuite/c-c++-common/musttail17.c
index 490f3c3..58fab84 100644
--- a/gcc/testsuite/c-c++-common/musttail17.c
+++ b/gcc/testsuite/c-c++-common/musttail17.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { musttail && { c || c++11 } } } } */
+/* { dg-do compile { target musttail } } */
struct box { char field[64]; int i; };
diff --git a/gcc/testsuite/c-c++-common/musttail18.c b/gcc/testsuite/c-c++-common/musttail18.c
index 4f34a8d..ab60887 100644
--- a/gcc/testsuite/c-c++-common/musttail18.c
+++ b/gcc/testsuite/c-c++-common/musttail18.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { musttail && { c || c++11 } } } } */
+/* { dg-do compile { target musttail } } */
/* { dg-additional-options "-fdelayed-branch" { target sparc*-*-* } } */
void __attribute__((noipa)) f() {}
diff --git a/gcc/testsuite/c-c++-common/musttail19.c b/gcc/testsuite/c-c++-common/musttail19.c
index 70f9eaf..a592b69 100644
--- a/gcc/testsuite/c-c++-common/musttail19.c
+++ b/gcc/testsuite/c-c++-common/musttail19.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { musttail && { c || c++11 } } } } */
+/* { dg-do compile { target musttail } } */
float f1(void);
@@ -10,8 +10,9 @@ int f2(void)
int f3(int *);
-int f4(void)
+int f4(int *p)
{
int x;
- __attribute__((musttail)) return f3(&x); /* { dg-error "\(refers to locals|other reasons\)" } */
+ (void) p;
+ __attribute__((musttail)) return f3(&x); /* { dg-warning "address of automatic variable 'x' passed to 'musttail' call argument" } */
}
diff --git a/gcc/testsuite/c-c++-common/musttail20.c b/gcc/testsuite/c-c++-common/musttail20.c
index 70f14ff..1931f2c 100644
--- a/gcc/testsuite/c-c++-common/musttail20.c
+++ b/gcc/testsuite/c-c++-common/musttail20.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { struct_musttail && { c || c++11 } } } } */
+/* { dg-do compile { target struct_musttail } } */
/* { dg-additional-options "-fdelayed-branch" { target sparc*-*-* } } */
struct str
diff --git a/gcc/testsuite/c-c++-common/musttail21.c b/gcc/testsuite/c-c++-common/musttail21.c
index 954209d..1a109e1 100644
--- a/gcc/testsuite/c-c++-common/musttail21.c
+++ b/gcc/testsuite/c-c++-common/musttail21.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { c || c++11 } } } */
+/* { dg-do compile { target musttail } } */
void f(void)
{
__attribute__((musttail)) return; /* { dg-error "cannot tail-call.*return value must be a call" } */
diff --git a/gcc/testsuite/c-c++-common/musttail28.c b/gcc/testsuite/c-c++-common/musttail28.c
new file mode 100644
index 0000000..d84658a
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/musttail28.c
@@ -0,0 +1,108 @@
+/* { dg-do compile { target { musttail && { c || c++11 } } } } */
+
+int foo (int, void *);
+int bar (int, int *);
+struct S { int a, b, c; };
+struct T { int d; struct S e; };
+
+int
+baz (int x, void *y)
+{
+ [[gnu::musttail]] return bar (2, &x); /* { dg-warning "address of parameter 'x' passed to 'musttail' call argument" } */
+}
+
+int
+qux (int x, void *y)
+{
+ __label__ lab;
+ lab:;
+ if (*(int *) y == 1)
+ [[gnu::musttail]] return foo (1, &&lab); /* { dg-warning "address of label passed to 'musttail' call argument" } */
+ if (x == 1)
+ [[gnu::musttail]] return foo (3, 0);
+ else if (x == 2)
+ {
+ {
+ int a = 42;
+ bar (4, &a);
+ }
+ [[gnu::musttail]] return bar (5, 0);
+ }
+ else if (x == 3)
+ {
+ int a = 42;
+ bar (4, &a);
+ [[gnu::musttail]] return bar (6, 0);
+ }
+ else if (x == 4)
+ {
+ int a = 42;
+ [[gnu::musttail]] return bar (7, &a); /* { dg-warning "address of automatic variable 'a' passed to 'musttail' call argument" } */
+ }
+ else if (x == 5)
+ {
+ struct T b;
+ [[gnu::musttail]] return bar (8, &b.e.b); /* { dg-warning "address of automatic variable 'b' passed to 'musttail' call argument" } */
+ }
+ else if (x == 6)
+ {
+ struct T b;
+ bar (9, &b.e.a);
+ [[gnu::musttail]] return bar (10, 0);
+ }
+ else if (x == 7)
+ {
+ {
+ struct T b;
+ bar (9, &b.e.a);
+ }
+ [[gnu::musttail]] return bar (11, 0);
+ }
+ else if (x == 8)
+ {
+ {
+ int a = 42;
+ bar (4, &a);
+ }
+ [[gnu::musttail]] return foo (12, 0);
+ }
+ else if (x == 9)
+ {
+ int a = 42;
+ bar (4, &a);
+ [[gnu::musttail]] return foo (13, 0);
+ }
+ else if (x == 10)
+ {
+ int a = 42;
+ [[gnu::musttail]] return foo (14, &a); /* { dg-warning "address of automatic variable 'a' passed to 'musttail' call argument" } */
+ }
+ else if (x == 11)
+ {
+ struct T b;
+ [[gnu::musttail]] return foo (15, &b.e.b); /* { dg-warning "address of automatic variable 'b' passed to 'musttail' call argument" } */
+ }
+ else if (x == 12)
+ {
+ struct T b;
+ bar (9, &b.e.a);
+ [[gnu::musttail]] return foo (16, 0);
+ }
+ else if (x == 13)
+ {
+ {
+ struct T b;
+ bar (9, &b.e.a);
+ }
+ [[gnu::musttail]] return foo (17, 0);
+ }
+ return 0;
+}
+
+int
+corge (int x, void *y)
+{
+ if (*(int *) y == 1)
+ bar (18, &x);
+ [[gnu::musttail]] return bar (2, 0);
+}
diff --git a/gcc/testsuite/c-c++-common/musttail29.c b/gcc/testsuite/c-c++-common/musttail29.c
new file mode 100644
index 0000000..f6b3d76
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/musttail29.c
@@ -0,0 +1,109 @@
+/* { dg-do compile { target { musttail && { c || c++11 } } } } */
+/* { dg-options "-O2 -Wmusttail-local-addr" } */
+
+int foo (int, void *);
+int bar (int, int *);
+struct S { int a, b, c; };
+struct T { int d; struct S e; };
+
+int
+baz (int x, void *y)
+{
+ [[gnu::musttail]] return bar (2, &x); /* { dg-warning "address of parameter 'x' passed to 'musttail' call argument" } */
+}
+
+int
+qux (int x, void *y)
+{
+ __label__ lab;
+ lab:;
+ if (*(int *) y == 1)
+ [[gnu::musttail]] return foo (1, &&lab); /* { dg-warning "address of label passed to 'musttail' call argument" } */
+ if (x == 1)
+ [[gnu::musttail]] return foo (3, 0);
+ else if (x == 2)
+ {
+ {
+ int a = 42;
+ bar (4, &a);
+ }
+ [[gnu::musttail]] return bar (5, 0);
+ }
+ else if (x == 3)
+ {
+ int a = 42;
+ bar (4, &a);
+ [[gnu::musttail]] return bar (6, 0);
+ }
+ else if (x == 4)
+ {
+ int a = 42;
+ [[gnu::musttail]] return bar (7, &a); /* { dg-warning "address of automatic variable 'a' passed to 'musttail' call argument" } */
+ }
+ else if (x == 5)
+ {
+ struct T b;
+ [[gnu::musttail]] return bar (8, &b.e.b); /* { dg-warning "address of automatic variable 'b' passed to 'musttail' call argument" } */
+ }
+ else if (x == 6)
+ {
+ struct T b;
+ bar (9, &b.e.a);
+ [[gnu::musttail]] return bar (10, 0);
+ }
+ else if (x == 7)
+ {
+ {
+ struct T b;
+ bar (9, &b.e.a);
+ }
+ [[gnu::musttail]] return bar (11, 0);
+ }
+ else if (x == 8)
+ {
+ {
+ int a = 42;
+ bar (4, &a);
+ }
+ [[gnu::musttail]] return foo (12, 0);
+ }
+ else if (x == 9)
+ {
+ int a = 42;
+ bar (4, &a);
+ [[gnu::musttail]] return foo (13, 0);
+ }
+ else if (x == 10)
+ {
+ int a = 42;
+ [[gnu::musttail]] return foo (14, &a); /* { dg-warning "address of automatic variable 'a' passed to 'musttail' call argument" } */
+ }
+ else if (x == 11)
+ {
+ struct T b;
+ [[gnu::musttail]] return foo (15, &b.e.b); /* { dg-warning "address of automatic variable 'b' passed to 'musttail' call argument" } */
+ }
+ else if (x == 12)
+ {
+ struct T b;
+ bar (9, &b.e.a);
+ [[gnu::musttail]] return foo (16, 0);
+ }
+ else if (x == 13)
+ {
+ {
+ struct T b;
+ bar (9, &b.e.a);
+ }
+ [[gnu::musttail]] return foo (17, 0);
+ }
+ return 0;
+}
+
+int
+corge (int x, void *y)
+{
+ if (*(int *) y == 1)
+ bar (18, &x);
+ [[gnu::musttail]] return bar (2, 0);
+}
diff --git a/gcc/testsuite/c-c++-common/musttail30.c b/gcc/testsuite/c-c++-common/musttail30.c
new file mode 100644
index 0000000..be1c3da
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/musttail30.c
@@ -0,0 +1,109 @@
+/* { dg-do compile { target { musttail && { c || c++11 } } } } */
+/* { dg-options "-Wextra" } */
+
+int foo (int, void *);
+int bar (int, int *);
+struct S { int a, b, c; };
+struct T { int d; struct S e; };
+
+int
+baz (int x, void *y)
+{
+ [[gnu::musttail]] return bar (2, &x); /* { dg-warning "address of parameter 'x' passed to 'musttail' call argument" } */
+}
+
+int
+qux (int x, void *y)
+{
+ __label__ lab;
+ lab:;
+ if (*(int *) y == 1)
+ [[gnu::musttail]] return foo (1, &&lab); /* { dg-warning "address of label passed to 'musttail' call argument" } */
+ if (x == 1)
+ [[gnu::musttail]] return foo (3, 0);
+ else if (x == 2)
+ {
+ {
+ int a = 42;
+ bar (4, &a);
+ }
+ [[gnu::musttail]] return bar (5, 0);
+ }
+ else if (x == 3)
+ {
+ int a = 42;
+ bar (4, &a);
+ [[gnu::musttail]] return bar (6, 0); /* { dg-warning "address of automatic variable 'a' can escape to 'musttail' call" } */
+ }
+ else if (x == 4)
+ {
+ int a = 42;
+ [[gnu::musttail]] return bar (7, &a); /* { dg-warning "address of automatic variable 'a' passed to 'musttail' call argument" } */
+ }
+ else if (x == 5)
+ {
+ struct T b;
+ [[gnu::musttail]] return bar (8, &b.e.b); /* { dg-warning "address of automatic variable 'b' passed to 'musttail' call argument" } */
+ }
+ else if (x == 6)
+ {
+ struct T b;
+ bar (9, &b.e.a);
+ [[gnu::musttail]] return bar (10, 0); /* { dg-warning "address of automatic variable 'b' can escape to 'musttail' call" } */
+ }
+ else if (x == 7)
+ {
+ {
+ struct T b;
+ bar (9, &b.e.a);
+ }
+ [[gnu::musttail]] return bar (11, 0);
+ }
+ else if (x == 8)
+ {
+ {
+ int a = 42;
+ bar (4, &a);
+ }
+ [[gnu::musttail]] return foo (12, 0);
+ }
+ else if (x == 9)
+ {
+ int a = 42;
+ bar (4, &a);
+ [[gnu::musttail]] return foo (13, 0); /* { dg-warning "address of automatic variable 'a' can escape to 'musttail' call" } */
+ }
+ else if (x == 10)
+ {
+ int a = 42;
+ [[gnu::musttail]] return foo (14, &a); /* { dg-warning "address of automatic variable 'a' passed to 'musttail' call argument" } */
+ }
+ else if (x == 11)
+ {
+ struct T b;
+ [[gnu::musttail]] return foo (15, &b.e.b); /* { dg-warning "address of automatic variable 'b' passed to 'musttail' call argument" } */
+ }
+ else if (x == 12)
+ {
+ struct T b;
+ bar (9, &b.e.a);
+ [[gnu::musttail]] return foo (16, 0); /* { dg-warning "address of automatic variable 'b' can escape to 'musttail' call" } */
+ }
+ else if (x == 13)
+ {
+ {
+ struct T b;
+ bar (9, &b.e.a);
+ }
+ [[gnu::musttail]] return foo (17, 0);
+ }
+ return 0;
+}
+
+int
+corge (int x, void *y)
+{
+ if (*(int *) y == 1)
+ bar (18, &x);
+ [[gnu::musttail]] return bar (2, 0); /* { dg-warning "address of parameter 'x' can escape to 'musttail' call" } */
+}
diff --git a/gcc/testsuite/c-c++-common/musttail31.c b/gcc/testsuite/c-c++-common/musttail31.c
new file mode 100644
index 0000000..f44ada4
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/musttail31.c
@@ -0,0 +1,109 @@
+/* { dg-do compile { target { musttail && { c || c++11 } } } } */
+/* { dg-options "-O2 -Wmaybe-musttail-local-addr" } */
+
+int foo (int, void *);
+int bar (int, int *);
+struct S { int a, b, c; };
+struct T { int d; struct S e; };
+
+int
+baz (int x, void *y)
+{
+ [[gnu::musttail]] return bar (2, &x); /* { dg-warning "address of parameter 'x' passed to 'musttail' call argument" } */
+}
+
+int
+qux (int x, void *y)
+{
+ __label__ lab;
+ lab:;
+ if (*(int *) y == 1)
+ [[gnu::musttail]] return foo (1, &&lab); /* { dg-warning "address of label passed to 'musttail' call argument" } */
+ if (x == 1)
+ [[gnu::musttail]] return foo (3, 0);
+ else if (x == 2)
+ {
+ {
+ int a = 42;
+ bar (4, &a);
+ }
+ [[gnu::musttail]] return bar (5, 0);
+ }
+ else if (x == 3)
+ {
+ int a = 42;
+ bar (4, &a);
+ [[gnu::musttail]] return bar (6, 0); /* { dg-warning "address of automatic variable 'a' can escape to 'musttail' call" } */
+ }
+ else if (x == 4)
+ {
+ int a = 42;
+ [[gnu::musttail]] return bar (7, &a); /* { dg-warning "address of automatic variable 'a' passed to 'musttail' call argument" } */
+ }
+ else if (x == 5)
+ {
+ struct T b;
+ [[gnu::musttail]] return bar (8, &b.e.b); /* { dg-warning "address of automatic variable 'b' passed to 'musttail' call argument" } */
+ }
+ else if (x == 6)
+ {
+ struct T b;
+ bar (9, &b.e.a);
+ [[gnu::musttail]] return bar (10, 0); /* { dg-warning "address of automatic variable 'b' can escape to 'musttail' call" } */
+ }
+ else if (x == 7)
+ {
+ {
+ struct T b;
+ bar (9, &b.e.a);
+ }
+ [[gnu::musttail]] return bar (11, 0);
+ }
+ else if (x == 8)
+ {
+ {
+ int a = 42;
+ bar (4, &a);
+ }
+ [[gnu::musttail]] return foo (12, 0);
+ }
+ else if (x == 9)
+ {
+ int a = 42;
+ bar (4, &a);
+ [[gnu::musttail]] return foo (13, 0); /* { dg-warning "address of automatic variable 'a' can escape to 'musttail' call" } */
+ }
+ else if (x == 10)
+ {
+ int a = 42;
+ [[gnu::musttail]] return foo (14, &a); /* { dg-warning "address of automatic variable 'a' passed to 'musttail' call argument" } */
+ }
+ else if (x == 11)
+ {
+ struct T b;
+ [[gnu::musttail]] return foo (15, &b.e.b); /* { dg-warning "address of automatic variable 'b' passed to 'musttail' call argument" } */
+ }
+ else if (x == 12)
+ {
+ struct T b;
+ bar (9, &b.e.a);
+ [[gnu::musttail]] return foo (16, 0); /* { dg-warning "address of automatic variable 'b' can escape to 'musttail' call" } */
+ }
+ else if (x == 13)
+ {
+ {
+ struct T b;
+ bar (9, &b.e.a);
+ }
+ [[gnu::musttail]] return foo (17, 0);
+ }
+ return 0;
+}
+
+int
+corge (int x, void *y)
+{
+ if (*(int *) y == 1)
+ bar (18, &x);
+ [[gnu::musttail]] return bar (2, 0); /* { dg-warning "address of parameter 'x' can escape to 'musttail' call" } */
+}
diff --git a/gcc/testsuite/c-c++-common/musttail8.c b/gcc/testsuite/c-c++-common/musttail8.c
index 50ca1ac..9a29030 100644
--- a/gcc/testsuite/c-c++-common/musttail8.c
+++ b/gcc/testsuite/c-c++-common/musttail8.c
@@ -10,8 +10,9 @@ int f2(void)
int f3(int *);
-int f4(void)
+int f4(int *p)
{
int x;
- [[gnu::musttail]] return f3(&x); /* { dg-error "\(refers to locals|other reasons\)" } */
+ (void) p;
+ [[gnu::musttail]] return f3(&x); /* { dg-warning "address of automatic variable 'x' passed to 'musttail' call argument" } */
}
diff --git a/gcc/testsuite/c-c++-common/pr118442.c b/gcc/testsuite/c-c++-common/pr118442.c
new file mode 100644
index 0000000..2472aa6
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr118442.c
@@ -0,0 +1,17 @@
+/* PR118442 */
+/* { dg-do compile { target { struct_musttail && { external_musttail && { c || c++11 } } } } } */
+/* { dg-options "-fprofile-generate -O2" } */
+/* { dg-require-profiling "-fprofile-generate" } */
+
+struct Span {
+ int test[5];
+};
+
+extern void resolveToBufferSlow (struct Span *buffer);
+
+void
+resolveToBuffer (struct Span *buffer)
+{
+ buffer->test[0] = 4;
+ [[clang::musttail]] return resolveToBufferSlow (buffer);
+}
diff --git a/gcc/testsuite/c-c++-common/pr119483-1.c b/gcc/testsuite/c-c++-common/pr119483-1.c
new file mode 100644
index 0000000..b2d7b57
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr119483-1.c
@@ -0,0 +1,29 @@
+/* PR tree-optimization/119483 */
+/* { dg-do compile { target musttail } } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "bar\[.a-z0-9]* \\\(\[^\n\r]*\\\); \\\[tail call\\\] \\\[must tail call\\\]" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "baz \\\(\[^\n\r]*\\\); \\\[tail call\\\] \\\[must tail call\\\]" 1 "optimized" } } */
+
+[[gnu::noreturn]] extern void foo (void);
+
+[[gnu::noinline]] static int
+bar (int x)
+{
+ (void) x;
+ foo ();
+ return 0;
+}
+
+[[gnu::noipa]] int
+baz (int x)
+{
+ return x + 42;
+}
+
+int
+qux (int x)
+{
+ if (x == 1)
+ [[gnu::musttail]] return bar (1);
+ [[gnu::musttail]] return baz (x);
+}
diff --git a/gcc/testsuite/c-c++-common/pr119483-2.c b/gcc/testsuite/c-c++-common/pr119483-2.c
new file mode 100644
index 0000000..e7b692d
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr119483-2.c
@@ -0,0 +1,12 @@
+/* PR tree-optimization/119483 */
+/* { dg-do compile { target musttail } } */
+/* { dg-options "-O2" } */
+
+[[noreturn]] int
+foo (int x)
+{
+ if (x > 10)
+ [[gnu::musttail]] return foo (x - 1); /* { dg-warning "function declared 'noreturn' has a 'return' statement" } */
+ for (;;)
+ ;
+}
diff --git a/gcc/testsuite/c-c++-common/pr119484.c b/gcc/testsuite/c-c++-common/pr119484.c
new file mode 100644
index 0000000..6ae7c9a
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr119484.c
@@ -0,0 +1,21 @@
+/* PR ipa/119484 */
+/* { dg-do compile { target musttail } } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "bar\[.a-z0-9]* \\\(\[^\n\r]*\\\); \\\[tail call\\\] \\\[must tail call\\\]" 1 "optimized" } } */
+
+void foo (int);
+
+[[gnu::noinline]] static int
+bar (int x)
+{
+ foo (x);
+ return 0;
+}
+
+int
+baz (int x)
+{
+ if (x == 1)
+ [[gnu::musttail]] return bar (x);
+ return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/pr119535.c b/gcc/testsuite/c-c++-common/pr119535.c
new file mode 100644
index 0000000..fd88cc4
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr119535.c
@@ -0,0 +1,31 @@
+/* PR gcov-profile/119535
+/* { dg-do compile { target musttail } } */
+/* { dg-options "-fprofile-generate -O2" } */
+/* { dg-require-profiling "-fprofile-generate" } */
+
+[[gnu::noipa]] int
+foo (int x)
+{
+ return 42 + x;
+}
+
+int
+bar (int x)
+{
+ foo (x);
+ foo (2);
+ [[clang::musttail]] return foo (3);
+}
+
+int
+baz (int x)
+{
+ if (x == 42)
+ return -1;
+ else if (x == 15)
+ return 25;
+ else if (x == 26)
+ [[clang::musttail]] return foo (4);
+ else
+ [[clang::musttail]] return foo (5);
+}
diff --git a/gcc/testsuite/c-c++-common/pr119537-1.c b/gcc/testsuite/c-c++-common/pr119537-1.c
new file mode 100644
index 0000000..7959826
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr119537-1.c
@@ -0,0 +1,23 @@
+/* PR middle-end/119537 */
+/* { dg-do compile } */
+/* { dg-options "-O0" } */
+
+volatile int v;
+void *bar (void *, void *);
+
+void
+foo (bool z)
+{
+ if (z)
+ goto *&&x; /* { dg-error "reference to label 'x' defined inside of 'assume' attribute expression from outside of the attribute" } */
+ /* { dg-message "as a possible target of computed goto" "" { target c++ } .-1 } */
+ [[gnu::assume (({ x: v += 1; true; }))]];/* { dg-message "'x' defined here" } */
+ /* { dg-warning "jump to label 'x'" "" { target c++ } .-1 } */
+ /* { dg-message "enters statement expression" "" { target c++ } .-2 } */
+ [[gnu::assume (({ y: v += 1; true; }))]];/* { dg-message "'y' defined here" } */
+ /* { dg-warning "jump to label 'y'" "" { target c++ } .-1 } */
+ goto *bar (&&x, &&y); /* { dg-error "reference to label 'x' defined inside of 'assume' attribute expression from outside of the attribute" } */
+ /* { dg-error "reference to label 'y' defined inside of 'assume' attribute expression from outside of the attribute" "" { target *-*-* } .-1 } */
+ /* { dg-message "as a possible target of computed goto" "" { target c++ } .-2 } */
+ /* { dg-message "enters statement expression" "" { target c++ } .-3 } */
+}
diff --git a/gcc/testsuite/c-c++-common/pr119537-2.c b/gcc/testsuite/c-c++-common/pr119537-2.c
new file mode 100644
index 0000000..7d65672
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr119537-2.c
@@ -0,0 +1,23 @@
+/* PR middle-end/119537 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+volatile int v;
+void *bar (void *, void *);
+
+void
+foo (bool z)
+{
+ if (z)
+ goto *&&x; /* { dg-error "reference to label 'x' defined inside of 'assume' attribute expression from outside of the attribute" } */
+ /* { dg-message "as a possible target of computed goto" "" { target c++ } .-1 } */
+ [[gnu::assume (({ x: v += 1; true; }))]];/* { dg-message "'x' defined here" } */
+ /* { dg-warning "jump to label 'x'" "" { target c++ } .-1 } */
+ /* { dg-message "enters statement expression" "" { target c++ } .-2 } */
+ [[gnu::assume (({ y: v += 1; true; }))]];/* { dg-message "'y' defined here" } */
+ /* { dg-warning "jump to label 'y'" "" { target c++ } .-1 } */
+ goto *bar (&&x, &&y); /* { dg-error "reference to label 'x' defined inside of 'assume' attribute expression from outside of the attribute" } */
+ /* { dg-error "reference to label 'y' defined inside of 'assume' attribute expression from outside of the attribute" "" { target *-*-* } .-1 } */
+ /* { dg-message "as a possible target of computed goto" "" { target c++ } .-2 } */
+ /* { dg-message "enters statement expression" "" { target c++ } .-3 } */
+}
diff --git a/gcc/testsuite/c-c++-common/pr119614-1.c b/gcc/testsuite/c-c++-common/pr119614-1.c
new file mode 100644
index 0000000..89105a3
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr119614-1.c
@@ -0,0 +1,28 @@
+/* PR tree-optimization/119614 */
+/* { dg-do compile { target musttail } } */
+/* { dg-options "-O2" } */
+
+volatile int v;
+
+[[gnu::noinline]] const char *
+foo (int x)
+{
+ v += x;
+ return 0;
+}
+
+const char *
+bar (int x)
+{
+ if (x == 42)
+ [[gnu::musttail]] return foo (42);
+ [[gnu::musttail]] return foo (32);
+}
+
+const char *
+baz (int x)
+{
+ if (x == 5)
+ return foo (42);
+ return foo (32);
+}
diff --git a/gcc/testsuite/c-c++-common/pr119614-2.c b/gcc/testsuite/c-c++-common/pr119614-2.c
new file mode 100644
index 0000000..8833eee
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr119614-2.c
@@ -0,0 +1,28 @@
+/* PR tree-optimization/119614 */
+/* { dg-do compile { target musttail } } */
+/* { dg-options "-O2" } */
+
+volatile int v;
+
+[[gnu::noinline]] const char *
+foo (int x)
+{
+ v += x;
+ return (const char *) -42;
+}
+
+const char *
+bar (int x)
+{
+ if (x == 42)
+ [[gnu::musttail]] return foo (42);
+ [[gnu::musttail]] return foo (32);
+}
+
+const char *
+baz (int x)
+{
+ if (x == 5)
+ return foo (42);
+ return foo (32);
+}
diff --git a/gcc/testsuite/c-c++-common/pr119614-3.c b/gcc/testsuite/c-c++-common/pr119614-3.c
new file mode 100644
index 0000000..59ed36b
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr119614-3.c
@@ -0,0 +1,28 @@
+/* PR tree-optimization/119614 */
+/* { dg-do compile { target musttail } } */
+/* { dg-options "-O2" } */
+
+volatile int v;
+
+[[gnu::noinline]] double
+foo (int x)
+{
+ v += x;
+ return 0.5;
+}
+
+double
+bar (int x)
+{
+ if (x == 42)
+ [[gnu::musttail]] return foo (42);
+ [[gnu::musttail]] return foo (32);
+}
+
+double
+baz (int x)
+{
+ if (x == 5)
+ return foo (42);
+ return foo (32);
+}
diff --git a/gcc/testsuite/c-c++-common/pr119616.c b/gcc/testsuite/c-c++-common/pr119616.c
new file mode 100644
index 0000000..5ffdb8c
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr119616.c
@@ -0,0 +1,23 @@
+/* PR tree-optimization/119616 */
+/* { dg-do compile { target external_musttail } } */
+/* { dg-options "-O2" } */
+
+int foo (int *);
+int bar (int);
+
+int
+baz (int x)
+{
+ if (!x)
+ [[gnu::musttail]] return bar (x);
+ return foo (&x);
+}
+
+int
+qux (int x)
+{
+ if (!x)
+ [[gnu::musttail]] return bar (x);
+ foo (&x);
+ return 1;
+}
diff --git a/gcc/testsuite/c-c++-common/pr119618.c b/gcc/testsuite/c-c++-common/pr119618.c
new file mode 100644
index 0000000..a56e669
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr119618.c
@@ -0,0 +1,21 @@
+/* PR gcov-profile/119618 */
+/* { dg-do compile { target musttail } } */
+/* { dg-options "-fcompare-debug -fprofile-generate -O1" } */
+/* { dg-require-profiling "-fprofile-generate" } */
+
+struct S { char s; };
+int foo (void);
+int *(*fn) (void);
+
+int *
+bar (void)
+{
+ if (foo ())
+ return 0;
+ {
+ struct S s;
+ do
+ [[gnu::musttail]] return fn ();
+ while (0);
+ }
+}