OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [libgomp/] [testsuite/] [libgomp.c/] [shared-2.c] - Diff between revs 273 and 338

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 273 Rev 338
#include <stdio.h>
#include <stdio.h>
#include <omp.h>
#include <omp.h>
 
 
extern void abort (void);
extern void abort (void);
 
 
void
void
parallel (int a, int b)
parallel (int a, int b)
{
{
  int bad, LASTPRIV, LASTPRIV_SEC;
  int bad, LASTPRIV, LASTPRIV_SEC;
  int i;
  int i;
 
 
  a = b = 3;
  a = b = 3;
 
 
  bad = 0;
  bad = 0;
 
 
  #pragma omp parallel firstprivate (a,b) shared (bad) num_threads (5)
  #pragma omp parallel firstprivate (a,b) shared (bad) num_threads (5)
    {
    {
      if (a != 3 || b != 3)
      if (a != 3 || b != 3)
        bad = 1;
        bad = 1;
 
 
      #pragma omp for lastprivate (LASTPRIV)
      #pragma omp for lastprivate (LASTPRIV)
      for (i = 0; i < 10; i++)
      for (i = 0; i < 10; i++)
        LASTPRIV = i;
        LASTPRIV = i;
 
 
      #pragma omp sections lastprivate (LASTPRIV_SEC)
      #pragma omp sections lastprivate (LASTPRIV_SEC)
        {
        {
          #pragma omp section
          #pragma omp section
            { LASTPRIV_SEC = 3; }
            { LASTPRIV_SEC = 3; }
 
 
          #pragma omp section
          #pragma omp section
            { LASTPRIV_SEC = 42; }
            { LASTPRIV_SEC = 42; }
        }
        }
 
 
    }
    }
 
 
  if (LASTPRIV != 9)
  if (LASTPRIV != 9)
    abort ();
    abort ();
 
 
  if (LASTPRIV_SEC != 42)
  if (LASTPRIV_SEC != 42)
    abort ();
    abort ();
 
 
  if (bad)
  if (bad)
    abort ();
    abort ();
}
}
 
 
int main()
int main()
{
{
  parallel (1, 2);
  parallel (1, 2);
  return 0;
  return 0;
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.