[patch, Fortran] Fix PR 50690

Thomas Koenig tkoenig@netcologne.de
Fri Oct 21 17:40:00 GMT 2011


Jakub Jelinek wrote:
> Though, what could be done is just special case OpenMP workshare regions,
> insert everything into BLOCK local vars unless in OpenMP workshare, in that
> case put the BLOCK with the temporary around the workshare rather than
> inside of it.  In the case of omp parallel workshare it would need
> to go in between omp parallel and omp workshare.

Well, here's a patch which implements this concept.  I chose to insert
the BLOCK in a separate pass because it was the cleanest way to avoid
infinite recursion when inserting a block.

Regression-tested.  OK for trunk?

	Thomas

2011-10-21  Thomas Koenig  <tkoenig@gcc.gnu.org>

         PR fortran/50690
         * frontend-passes.c (workshare_level):  New variable.
         (create_var):  Put the newly created variable into the block
         around the WORKSHARE.
         (enclose_workshare):  New callback function to enclose
         WORKSHAREs in blocks.
         (optimize_namespace):  Use it.
         (gfc_code_walker):  Save/restore current namespace when
         following a BLOCK.  Keep track of workshare level.

2011-10-21  Thomas Koenig  <tkoenig@gcc.gnu.org>

         PR fortran/50690
         * gfortran.dg/gomp/workshare2.f90:  New test.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: workshare-6.diff
Type: text/x-patch
Size: 3959 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20111021/1272d590/attachment.bin>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: workshare2.f90
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20111021/1272d590/attachment.f90>


More information about the Fortran mailing list