gcc/libgomp/testsuite/libgomp.c/shared-1.c
Marek Polacek 44a0c6cbeb affinity-1.c: Fix implicit declarations.
* testsuite/libgomp.c/affinity-1.c: Fix implicit declarations.
	* testsuite/libgomp.c/nqueens-1.c: Likewise.
	* testsuite/libgomp.c/pr26943-3.c: Likewise.
	* testsuite/libgomp.c/pr26943-4.c: Likewise.
	* testsuite/libgomp.c/pr36802-2.c: Likewise.
	* testsuite/libgomp.c/pr36802-3.c: Likewise.
	* testsuite/libgomp.c/thread-limit-1.c: Likewise.
	* testsuite/libgomp.c/thread-limit-2.c: Likewise.
	* testsuite/libgomp.c/appendix-a/a.15.1.c: Include <omp.h>.
	* testsuite/libgomp.c/omp-loop02.c: Fix defaulting to int.
	* testsuite/libgomp.c/omp-parallel-for.c: Likewise.
	* testsuite/libgomp.c/omp-parallel-if.c: Likewise.
	* testsuite/libgomp.c/omp-single-1.c: Likewise.
	* testsuite/libgomp.c/omp-single-2.c: Likewise.
	* testsuite/libgomp.c/omp_matvec.c: Likewise.
	* testsuite/libgomp.c/omp_workshare3.c: Likewise.
	* testsuite/libgomp.c/omp_workshare4.c: Likewise.
	* testsuite/libgomp.c/shared-1.c: Fix defaulting to int.  Fix implicit
	declarations.

From-SVN: r215922
2014-10-06 10:20:45 +00:00

61 lines
843 B
C

extern void abort (void);
extern int omp_get_num_threads (void);
struct Y
{
int l[5][10];
};
struct X
{
struct Y y;
float b[10];
};
void
parallel (int a, int b)
{
int i, j;
struct X A[10][5];
a = b = 3;
for (i = 0; i < 10; i++)
for (j = 0; j < 5; j++)
A[i][j].y.l[3][3] = -10;
#pragma omp parallel shared (a, b, A) num_threads (5)
{
int i, j;
#pragma omp atomic
a += omp_get_num_threads ();
#pragma omp atomic
b += omp_get_num_threads ();
#pragma omp for private (j)
for (i = 0; i < 10; i++)
for (j = 0; j < 5; j++)
A[i][j].y.l[3][3] += 20;
}
for (i = 0; i < 10; i++)
for (j = 0; j < 5; j++)
if (A[i][j].y.l[3][3] != 10)
abort ();
if (a != 28)
abort ();
if (b != 28)
abort ();
}
int
main()
{
parallel (1, 2);
return 0;
}