OSDN Git Service

PR tree-optimization/31769
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / gomp / pr29965-8.C
1 // PR middle-end/29965
2 // Test that OpenMP construct bodies which never return don't cause ICEs.
3 // This is invalid code, but we don't emit diagnostics for it, nevertheless
4 // we test that we don't ICE on it.
5 // { dg-do compile }
6 // { dg-options "-O2 -fopenmp" }
7
8 void
9 foo1 ()
10 {
11 #pragma omp sections
12   {
13     throw 0;
14   }
15 }
16
17 void
18 bar1 ()
19 {
20 #pragma omp sections
21   {
22 #pragma omp section
23     throw 0;
24 #pragma omp section
25     throw 0;
26   }
27 }
28
29 void
30 foo2 ()
31 {
32 #pragma omp sections
33   {
34     ;
35 #pragma omp section
36     throw 0;
37   }
38 }
39
40 void
41 bar2 ()
42 {
43 #pragma omp sections
44   {
45 #pragma omp section
46     throw 0;
47 #pragma omp section
48     ;
49   }
50 }
51
52 void
53 foo3 ()
54 {
55 #pragma omp parallel sections
56   {
57     throw 0;
58   }
59 }
60
61 void
62 bar3 ()
63 {
64 #pragma omp parallel sections
65   {
66 #pragma omp section
67     throw 0;
68 #pragma omp section
69     throw 0;
70   }
71 }
72
73 void
74 foo4 ()
75 {
76 #pragma omp parallel sections
77   {
78     ;
79 #pragma omp section
80     throw 0;
81   }
82 }
83
84 void
85 bar4 ()
86 {
87 #pragma omp parallel sections
88   {
89 #pragma omp section
90     throw 0;
91 #pragma omp section
92     ;
93   }
94 }