[Patch, Fortran] Fix PR 50564

Thomas Koenig tkoenig@netcologne.de
Sun Oct 9 17:52:00 GMT 2011


Hello world,

the attached patch fixes the PR by removing common function elimination
in FORALL statements.

In the course of fixing this PR, I had originally fixed the ICE only to
find that the transformation (where f is a function)

forall (i=1:2)
   a(i) = f(i) + f(i)
end forall

to

forall (i=1:2)
   tmp = f(i)
   a(i) = tmp
end forall

did the Wrong Thing.  Oh well...

Regression-tested. OK for tunk?

	Thomas

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

         PR fortran/50564
         * frontend-passes (forall_level):  New variable.
         (cfe_register_funcs):  Don't register functions if we
         are within a forall loop.
         (optimize_namespace):  Set forall_level to 0 before entry.
         (gfc_code_walker):  Increase/decrease forall_level.

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

         PR fortran/50564
         * gfortran.dg/forall_15.f90:  New test case.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p2.diff
Type: text/x-patch
Size: 1649 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20111009/99d3b43f/attachment.bin>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: forall_15.f90
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20111009/99d3b43f/attachment.f90>


More information about the Fortran mailing list