From patchwork Tue Sep 14 16:28:38 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: Empty static constructor folding Date: Tue, 14 Sep 2010 06:28:38 -0000 From: Jan Hubicka X-Patchwork-Id: 64728 Message-Id: <20100914162838.GD22498@kam.mff.cuni.cz> To: Jakub Jelinek Cc: Andrew Pinski , Jan Hubicka , "H.J. Lu" , gcc-patches@gcc.gnu.org, rguenther@suse.de > On Mon, Sep 13, 2010 at 01:04:45PM -0700, Andrew Pinski wrote: > > On Mon, Sep 13, 2010 at 12:55 PM, Jan Hubicka wrote: > > > It seems that those testcases just need some obstructation to avoid folding.  I wonder how I make varianble public in fortran? > > > > The easy way is to put the variables in a module and then do a "use > > module". Right now the variables in the program are really local to > > the function (either auto or static depending on the size of the array > > in this case they are huge so they are static). > > Or you can add > common // a, b, c > or > call fill (a, b) > with > subroutine fill(a, b) > integer, parameter :: kp = 4 > integer, parameter :: n = 2000 > complex(kp), dimension(n,n) :: a,b > a = 1 > b = 1 > end subroutine fill > or something similar. Thanks, I believe making them common is precisely what I want to get original behaviour. So I comitted the following. It fixed the testcase for me. Index: ChangeLog =================================================================== --- ChangeLog (revision 164281) +++ ChangeLog (working copy) @@ -1,3 +1,8 @@ +2010-09-14 Jan Hubicka + + * gfortran.dg/vect/fast-math-pr38968.f90: Add common to prevent + folding. + 2010-09-14 Jakub Jelinek PR middle-end/45567 Index: gfortran.dg/vect/fast-math-pr38968.f90 =================================================================== --- gfortran.dg/vect/fast-math-pr38968.f90 (revision 164250) +++ gfortran.dg/vect/fast-math-pr38968.f90 (working copy) @@ -10,6 +10,7 @@ program mymatmul complex(kp), dimension(n,n) :: a,b,c real :: t1, t2 integer :: i, j, k + common // a,b,c do j = 1, n do k = 1, n