26127932dd
PR middle-end/53580 * omp-low.c (scan_omp): Change first argument to gimple_seq *, call walk_gimple_seq_mod instead of walk_gimple_seq. (scan_sharing_clauses, scan_omp_parallel, scan_omp_task, scan_omp_for, scan_omp_sections, scan_omp_single, execute_lower_omp): Adjust callers. (scan_omp_1_stmt): Likewise. If check_omp_nesting_restrictions returns false, replace stmt with GIMPLE_NOP. (check_omp_nesting_restrictions): Instead of issuing warnings, issue errors and return false if any errors were reported. * gcc.dg/gomp/nesting-1.c: Expect errors rather than warnings. * gcc.dg/gomp/critical-4.c: Likewise. * gfortran.dg/gomp/appendix-a/a.35.1.f90: Likewise. * gfortran.dg/gomp/appendix-a/a.35.3.f90: Likewise. * gfortran.dg/gomp/appendix-a/a.35.4.f90: Likewise. * gfortran.dg/gomp/appendix-a/a.35.6.f90: Likewise. * c-c++-common/gomp/pr53580.c: New test. * testsuite/libgomp.c/pr26943-2.c: Remove #pragma omp barrier, use GOMP_barrier () call instead. * testsuite/libgomp.c/pr26943-3.c: Likewise. * testsuite/libgomp.c/pr26943-4.c: Likewise. * testsuite/libgomp.fortran/vla4.f90: Remove !$omp barrier, call GOMP_barrier instead. * testsuite/libgomp.fortran/vla5.f90: Likewise. From-SVN: r188298
63 lines
1.4 KiB
C
63 lines
1.4 KiB
C
/* PR c++/26943 */
|
|
/* { dg-do run } */
|
|
|
|
extern int omp_set_dynamic (int);
|
|
extern int omp_get_thread_num (void);
|
|
extern void abort (void);
|
|
extern void GOMP_barrier (void);
|
|
|
|
int a = 8, b = 12, c = 16, d = 20, j = 0, l = 0;
|
|
char e[10] = "a", f[10] = "b", g[10] = "c", h[10] = "d";
|
|
volatile int k;
|
|
|
|
int
|
|
main (void)
|
|
{
|
|
int i;
|
|
omp_set_dynamic (0);
|
|
omp_set_nested (1);
|
|
#pragma omp parallel num_threads (2) reduction (+:l) \
|
|
firstprivate (a, b, c, d, e, f, g, h, j)
|
|
if (k == omp_get_thread_num ())
|
|
{
|
|
#pragma omp parallel for shared (a, e) firstprivate (b, f) \
|
|
lastprivate (c, g) private (d, h) \
|
|
schedule (static, 1) num_threads (4) \
|
|
reduction (+:j)
|
|
for (i = 0; i < 4; i++)
|
|
{
|
|
if (a != 8 || b != 12 || e[0] != 'a' || f[0] != 'b')
|
|
j++;
|
|
GOMP_barrier ();
|
|
#pragma omp atomic
|
|
a += i;
|
|
b += i;
|
|
c = i;
|
|
d = i;
|
|
#pragma omp atomic
|
|
e[0] += i;
|
|
f[0] += i;
|
|
g[0] = 'g' + i;
|
|
h[0] = 'h' + i;
|
|
GOMP_barrier ();
|
|
if (a != 8 + 6 || b != 12 + i || c != i || d != i)
|
|
j += 8;
|
|
if (e[0] != 'a' + 6 || f[0] != 'b' + i || g[0] != 'g' + i)
|
|
j += 64;
|
|
if (h[0] != 'h' + i)
|
|
j += 512;
|
|
}
|
|
if (j || a != 8 + 6 || b != 12 || c != 3 || d != 20)
|
|
++l;
|
|
if (e[0] != 'a' + 6 || f[0] != 'b' || g[0] != 'g' + 3 || h[0] != 'd')
|
|
l += 8;
|
|
}
|
|
if (l)
|
|
abort ();
|
|
if (a != 8 || b != 12 || c != 16 || d != 20)
|
|
abort ();
|
|
if (e[0] != 'a' || f[0] != 'b' || g[0] != 'c' || h[0] != 'd')
|
|
abort ();
|
|
return 0;
|
|
}
|