* [patch, fortran] Fix PR 85387
@ 2018-04-14 11:35 Thomas König
2018-04-14 13:22 ` Andre Vehreschild
0 siblings, 1 reply; 3+ messages in thread
From: Thomas König @ 2018-04-14 11:35 UTC (permalink / raw)
To: fortran, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 521 bytes --]
Hello world,
the attached patch fixes the PR, an 8 regression caused by
trying to convert a nested implied DO loop to an array
for a case where this was not possible.
Regression-tested. OK for trunk?
Regards
Thomas
2018-04-14 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/85387
* frontend-passes.c (traverse_io_block): Check for start, end or
stride being defined by an outer implied DO loop.
2018-04-14 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/85387
* gfortran.dg/implied_do_io_5.f90: New test.
[-- Attachment #2: p2.diff --]
[-- Type: text/x-patch, Size: 823 bytes --]
Index: frontend-passes.c
===================================================================
--- frontend-passes.c (Revision 259222)
+++ frontend-passes.c (Arbeitskopie)
@@ -1237,6 +1237,23 @@ traverse_io_block (gfc_code *code, bool *has_reach
}
}
+ /* Check for cases like ((a(i, j), i=1, j), j=1, 2). */
+ for (int i = 1; i < ref->u.ar.dimen; i++)
+ {
+ if (iters[i])
+ {
+ gfc_expr *var = iters[i]->var;
+ for (int j = i - 1; j < i; j++)
+ {
+ if (iters[j]
+ && (gfc_check_dependency (var, iters[j]->start, true)
+ || gfc_check_dependency (var, iters[j]->end, true)
+ || gfc_check_dependency (var, iters[j]->step, true)))
+ return false;
+ }
+ }
+ }
+
/* Create new expr. */
new_e = gfc_copy_expr (curr->expr1);
new_e->expr_type = EXPR_VARIABLE;
[-- Attachment #3: implied_do_io_5.f90 --]
[-- Type: text/x-fortran, Size: 414 bytes --]
! { dg-do run }
! { dg-additional-options "-ffrontend-optimize" }
! PR fortran/85387 - incorrect output
! Original test case by Vittorio Zecca
program main
real :: efg_pw(2,2)
character (len=80) :: c1, c2
efg_pw(1,1)=1
efg_pw(2,1)=2
efg_pw(1,2)=3
efg_pw(2,2)=4
write (unit=c1,fmt='(3F12.5)') ((efg_pw(i, j), i=1, j), j=1, 2)
write (unit=c2,fmt='(3F12.5)') 1.0, 3.0, 4.0
if (c1 /= c2) stop 1
end
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch, fortran] Fix PR 85387
2018-04-14 11:35 [patch, fortran] Fix PR 85387 Thomas König
@ 2018-04-14 13:22 ` Andre Vehreschild
2018-04-14 14:01 ` Thomas König
0 siblings, 1 reply; 3+ messages in thread
From: Andre Vehreschild @ 2018-04-14 13:22 UTC (permalink / raw)
To: Thomas König; +Cc: fortran, gcc-patches
Hi Thomas,
this looks good. Ok for trunk. Thanks for the patch.
- Andre
On Sat, 14 Apr 2018 13:35:37 +0200
Thomas König <tk@tkoenig.net> wrote:
> Hello world,
>
> the attached patch fixes the PR, an 8 regression caused by
> trying to convert a nested implied DO loop to an array
> for a case where this was not possible.
>
> Regression-tested. OK for trunk?
>
> Regards
>
> Thomas
>
> 2018-04-14 Thomas Koenig <tkoenig@gcc.gnu.org>
>
> PR fortran/85387
> * frontend-passes.c (traverse_io_block): Check for start, end or
> stride being defined by an outer implied DO loop.
>
> 2018-04-14 Thomas Koenig <tkoenig@gcc.gnu.org>
>
> PR fortran/85387
> * gfortran.dg/implied_do_io_5.f90: New test.
--
Andre Vehreschild * Email: vehre ad gmx dot de
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch, fortran] Fix PR 85387
2018-04-14 13:22 ` Andre Vehreschild
@ 2018-04-14 14:01 ` Thomas König
0 siblings, 0 replies; 3+ messages in thread
From: Thomas König @ 2018-04-14 14:01 UTC (permalink / raw)
To: Andre Vehreschild; +Cc: fortran, gcc-patches
Hi Andre,
> this looks good. Ok for trunk. Thanks for the patch.
Committed as r259384. Thanks for the quick review!
Looking at the serious regressions from the gcc home page,
we are fast approaching the gcc 8 release. Serious regressions
are below 100, and there are currently only
So, if anybody has any bugs that should urgently be fixed
for the release, please go ahead :-)
Regards
Thomas
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-04-14 14:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-14 11:35 [patch, fortran] Fix PR 85387 Thomas König
2018-04-14 13:22 ` Andre Vehreschild
2018-04-14 14:01 ` Thomas König
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).