[gomp] Fix gcc_unreachable() bug on #pragma omp for (PR middle-end/30538)

Jakub Jelinek jakub@redhat.com
Mon Jan 22 10:18:00 GMT 2007


On Mon, Jan 22, 2007 at 02:39:53AM +0100, kuba@et.pl wrote:
> I've create a patch for a bug in GCC which I found today.

This patch is incorrect, you are issuing error on many valid
OpenMP sources (including many in the testsuite, the patch clearly
wasn't tested with make check:
FAIL: libgomp.c/omp-loop03.c (test for excess errors)
FAIL: libgomp.c/omp_orphan.c (test for excess errors)
FAIL: libgomp.c++/loop-3.C  -O  (test for excess errors)
FAIL: libgomp.c++/pr26943.C  -O0  (test for excess errors)
FAIL: libgomp.c++/pr26943.C  -O1  (test for excess errors)
FAIL: libgomp.c++/pr26943.C  -O2  (test for excess errors)
FAIL: libgomp.c++/pr26943.C  -O3 -fomit-frame-pointer  (test for excess errors)
FAIL: libgomp.c++/pr26943.C  -O3 -fomit-frame-pointer -funroll-loops  (test for excess errors)
FAIL: libgomp.c++/pr26943.C  -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions  (test for excess errors)
FAIL: libgomp.c++/pr26943.C  -O3 -g  (test for excess errors)
FAIL: libgomp.c++/pr26943.C  -Os  (test for excess errors)
FAIL: libgomp.fortran/omp_orphan.f  -O  (test for excess errors)
FAIL: libgomp.fortran/pr27416-1.f90  -O0  (internal compiler error)
FAIL: libgomp.fortran/pr27416-1.f90  -O0  (test for excess errors)
FAIL: libgomp.fortran/pr27416-1.f90  -O1  (test for excess errors)
FAIL: libgomp.fortran/pr27416-1.f90  -O2  (test for excess errors)
FAIL: libgomp.fortran/pr27416-1.f90  -O3 -fomit-frame-pointer  (test for excess errors)
FAIL: libgomp.fortran/pr27416-1.f90  -O3 -fomit-frame-pointer -funroll-loops  (test for excess errors)
FAIL: libgomp.fortran/pr27416-1.f90  -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions  (test for excess errors)
FAIL: libgomp.fortran/pr27416-1.f90  -O3 -g  (test for excess errors)
FAIL: libgomp.fortran/pr27416-1.f90  -Os  (test for excess errors)
are the new failures).  Citing the standard e.g. on the firstprivate
restrictions:

"A list item that is private within a parallel region, or that appears in the
reduction clause of a parallel construct, must not appear in a firstprivate
clause on a work-sharing construct if any of the work-sharing
regions arising from the work-sharing construct ever bind to any of the parallel
regions arising from the parallel construct."

The binding is not necessarily a static property, the compiler often doesn't
know what constructs will bind to which parallel regions at runtime.
Your patch issues an error on any firstprivate/lastprivate/reduction in
orphaned constructs, while what the compiler should error on is if it can
prove a variable mentioned in firstprivate/lastprivate/reduction
clauses can't possibly be shared in any possible containing parallel region.

	Jakub



More information about the Gcc-patches mailing list