aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/pr81052.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/c-c++-common/pr81052.c')
-rw-r--r--gcc/testsuite/c-c++-common/pr81052.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/testsuite/c-c++-common/pr81052.c b/gcc/testsuite/c-c++-common/pr81052.c
new file mode 100644
index 00000000000..6bc2879951e
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr81052.c
@@ -0,0 +1,28 @@
+/* PR middle-end/81052 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp-simd -O2" } */
+
+int
+foo (int x, int y)
+{
+ int i;
+#pragma omp simd
+ for (i = x; i < y; ++i)
+ return 0; /* { dg-error "invalid branch to/from OpenMP structured block" } */
+ return 1;
+}
+
+#ifdef __cplusplus
+template <typename T>
+T
+bar (T x, T y)
+{
+ T i;
+#pragma omp simd
+ for (i = x; i < y; ++i)
+ return 0; /* { dg-error "invalid branch to/from OpenMP structured block" "" { target c++ } } */
+ return 1;
+}
+
+int x = bar (1, 7);
+#endif