Empty static constructor folding

Jan Hubicka hubicka@ucw.cz
Tue Sep 14 17:58:00 GMT 2010


> On Mon, Sep 13, 2010 at 01:04:45PM -0700, Andrew Pinski wrote:
> > On Mon, Sep 13, 2010 at 12:55 PM, Jan Hubicka <hubicka@ucw.cz> 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  <jh@suse.cz>
+
+	* gfortran.dg/vect/fast-math-pr38968.f90: Add common to prevent
+	folding.
+
 2010-09-14  Jakub Jelinek  <jakub@redhat.com>
 
 	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



More information about the Gcc-patches mailing list