This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch, fortran] Fix for PR 60522
- From: Mikael Morin <mikael dot morin at sfr dot fr>
- To: Thomas Koenig <tkoenig at netcologne dot de>, gcc-patches <gcc-patches at gcc dot gnu dot org>, "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>
- Date: Sun, 16 Mar 2014 22:03:16 +0100
- Subject: Re: [patch, fortran] Fix for PR 60522
- Authentication-results: sourceware.org; auth=none
- References: <53257FE2 dot 5010802 at netcologne dot de>
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