This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gomp] Fix omp single


On Wed, Sep 28, 2005 at 08:09:06AM -0400, Diego Novillo wrote:
> There isn't a barrier at the end of thread bodies as I thought there was.

If you return from the __omp_fn.N function, there is indeed a 
barrier: either in libgomp or in GOMP_parallel_end.

But you're forgetting these directives needn't be nested 
directly inside the omp parallel.

	void foo()
	{
	#pragma omp single copyprivate(x,y,z)
	  x = , y = , z = ...;
	}

	void bar()
	{
	  clobber stack;
	}

	void baz()
	{
	  for (int i = 0; i < 10; i++)
	    foo(), bar();
	}

	int main()
	{
	#pragma omp parallel
	  baz ();
	}


r~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]