* [patch, fortran] Fix PR 80988
@ 2017-06-09 20:47 Thomas Koenig
2017-06-09 23:45 ` Jerry DeLisle
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Koenig @ 2017-06-09 20:47 UTC (permalink / raw)
To: fortran, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 558 bytes --]
Hello world,
the attached patch fixes the PR by not doing a replacement of
(a(i,i),i=1,3) by an array expression (which does not exist).
Regression-tested. OK for trunk?
Regards
Thomas
2017-06-09 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/80988
* frontend-passes.c (traverse_io_block): Also
check for variables occurring as indices multiple
time in a single implied DO loop.
2017-06-09 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/80988
* gfortran.dg/implied_do_io_3.f90: New test.
[-- Attachment #2: p-swim.diff --]
[-- Type: text/x-patch, Size: 678 bytes --]
Index: frontend-passes.c
===================================================================
--- frontend-passes.c (Revision 249039)
+++ frontend-passes.c (Arbeitskopie)
@@ -1164,7 +1164,14 @@ traverse_io_block (gfc_code *code, bool *has_reach
/* Check for (a(k), i=1,4) or ((a(j, i), i=1,4), j=1,4). */
if (!stack_top || !stack_top->iter
|| stack_top->iter->var->symtree != start->symtree)
- iters[i] = NULL;
+ {
+ /* Check for (a(i,i), i=1,3). */
+ for (j=0; j<i; j++)
+ if (iters[j] && iters[j]->var->symtree == start->symtree)
+ return false;
+
+ iters[i] = NULL;
+ }
else
{
iters[i] = stack_top->iter;
[-- Attachment #3: implied_do_io_3.f90 --]
[-- Type: text/x-fortran, Size: 794 bytes --]
! { dg-do run }
! { dg-options "-ffrontend-optimize" }
! PR 80988 - implied do loops with diagonal elements
! were not written correctly
program main
implicit none
integer :: i,j,k
integer, dimension(3,3) :: a
integer, dimension(3,3,3) :: b
character(len=40) :: line
a = reshape([(((i*10+j),i=1,3),j=1,3)], shape(a))
i = 2147483548
write (unit=line,fmt='(10I3)') (a(i,i),i=1,3)
if (line /= ' 11 22 33') call abort
write (unit=line,fmt='(10I3)') (a(i+1,i+1),i=1,2)
if (line /= ' 22 33') call abort
do k=1,3
do j=1,3
do i=1,3
b(i,j,k) = i*100 + j*10 + k
end do
end do
end do
i = -2147483548
write (unit=line,fmt='(10I4)') ((b(i,j,i),i=1,3),j=1,3)
if (line /= ' 111 212 313 121 222 323 131 232 333') call abort
end program main
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [patch, fortran] Fix PR 80988
2017-06-09 20:47 [patch, fortran] Fix PR 80988 Thomas Koenig
@ 2017-06-09 23:45 ` Jerry DeLisle
0 siblings, 0 replies; 2+ messages in thread
From: Jerry DeLisle @ 2017-06-09 23:45 UTC (permalink / raw)
To: Thomas Koenig, fortran, gcc-patches
On 06/09/2017 01:47 PM, Thomas Koenig wrote:
> Hello world,
>
> the attached patch fixes the PR by not doing a replacement of
> (a(i,i),i=1,3) by an array expression (which does not exist).
>
> Regression-tested. OK for trunk?
>
OK, thanks
> Regards
>
> Thomas
>
> 2017-06-09 Thomas Koenig <tkoenig@gcc.gnu.org>
>
> PR fortran/80988
> * frontend-passes.c (traverse_io_block): Also
> check for variables occurring as indices multiple
> time in a single implied DO loop.
>
> 2017-06-09 Thomas Koenig <tkoenig@gcc.gnu.org>
>
> PR fortran/80988
> * gfortran.dg/implied_do_io_3.f90: New test.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-06-09 23:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-09 20:47 [patch, fortran] Fix PR 80988 Thomas Koenig
2017-06-09 23:45 ` Jerry DeLisle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).