This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch, fortran] Fix for PR 60522


Le 16/03/2014 11:41, Thomas Koenig a écrit :
> Hello world,
> 
> the attached patch fixes PR 60522, a regresseion where temporary 
> variables were incorrectly introduced in a BLOCK within a WHERE 
> statement.
> 
> Regression-tested on x86_64-unknown-linux-gnu.
> 
> OK for trunk and the other open branches?
> 
I have a testcase that I'm pretty sure you won't like. ;-)

I outputs with -ffrontend-optimize:
0	0	260	442	696

and without:
0	0	1468	8202	31260


Mikael


program foo

  implicit none
  integer, parameter :: n = 5

  integer :: i

  integer, dimension(n) :: a
  integer, dimension(n) :: b = (/ (i + 2, i=1,size(b)) /)
  integer, dimension(n) :: c = (/ (i*i, i=1,size(c)) /)
  integer, dimension(n) :: d

  d = 0
  a = b
  where(c > b)
    a = c
    d = bar(a) + bar(a)
  end where

  print *, d

contains

  pure function bar(x)
    integer, dimension(n), intent(in) :: x
    integer, dimension(n) :: bar

    bar = x * x * x + 5
  end function bar

end program foo


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]