view libgomp/testsuite/libgomp.c/pr34513.c @ 63:b7f97abdc517 gcc-4.6-20100522

update gcc from gcc-4.5.0 to gcc-4.6
author ryoma <e075725@ie.u-ryukyu.ac.jp>
date Mon, 24 May 2010 12:47:05 +0900
parents a06113de4d67
children
line wrap: on
line source

/* PR c++/34513 */
/* { dg-do run } */

#include <omp.h>

extern void abort ();

static int errors = 0;
static int thrs = 4;

int
main ()
{
  omp_set_dynamic (0);

  #pragma omp parallel num_threads (thrs)
  {
    static int shrd = 0;

    #pragma omp atomic
      shrd += 1;

    #pragma omp barrier

    if (shrd != thrs)
      #pragma omp atomic
	errors += 1;
  }

  if (errors)
    abort ();
  return 0;
}