analyzer: enable taint state machine by default [PR103533]
[official-gcc.git] / gcc / testsuite / c-c++-common / gomp / teams-3.c
blob7f8b47f7df075d14cfc0a1da99e72edffe4f124d
1 /* PR middle-end/102972 */
3 #ifdef __cplusplus
4 extern "C" {
5 #endif
7 /* From omp.h */
8 extern int omp_get_num_teams (void);
9 extern void omp_set_num_teams (int);
10 extern int omp_get_team_size (int);
11 extern int omp_get_team_num (void);
12 extern int omp_get_max_teams (void);
13 extern void omp_set_teams_thread_limit (int);
14 extern int omp_get_teams_thread_limit (void);
15 extern int omp_is_initial_device (void);
16 extern int omp_get_num_threads (void);
19 #ifdef __cplusplus
21 #endif
24 void valid ()
26 #pragma omp teams
28 #pragma omp distribute
29 for (int i = 0; i < 64; i++)
32 int n = omp_get_num_teams ();
33 if (n >= omp_get_team_num ())
34 __builtin_abort ();
36 #pragma omp parallel for
37 for (int i = 0; i < 64; i++)
38 if (!omp_is_initial_device () || omp_get_num_threads () < 0)
39 __builtin_abort ();
41 #pragma omp loop
42 for (int i = 0; i < 64; i++)
47 void invalid_nest ()
49 #pragma omp teams
51 #pragma distribute parallel for simd
52 for (int i = 0; i < 64; i++)
55 int n = 0;
56 n += omp_get_team_size (0); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_team_size\[^\n\r]*' strictly nested in a 'teams' region" } */
57 n += omp_get_num_teams ();
58 n += omp_get_team_num ();
59 omp_set_num_teams (n); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_set_num_teams\[^\n\r]*' strictly nested in a 'teams' region" } */
60 n += omp_get_max_teams (); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_max_teams\[^\n\r]*' strictly nested in a 'teams' region" } */
61 n += omp_get_teams_thread_limit (); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_teams_thread_limit\[^\n\r]*' strictly nested in a 'teams' region" } */
62 omp_set_teams_thread_limit (n); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_set_teams_thread_limit\[^\n\r]*' strictly nested in a 'teams' region" } */