* [patch, fortran] Fix another dependency check for reallocation on assignment
@ 2017-07-23 11:27 Thomas Koenig
2017-07-23 19:47 ` Jerry DeLisle
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Koenig @ 2017-07-23 11:27 UTC (permalink / raw)
To: fortran, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 669 bytes --]
Hello world,
in PR 66102, I found a patch by Mikael which has never been applied.
After dusting it off, finding that it looks reasonable and fixes
the test case in question I'd like to apply this.
Regression-tested. OK for trunk?
Regards
Thomas
2017-07-23 Thomas Koenig <tkoenig@gcc.gnu.org>
Mikael Morin <mikael@gcc.gnu.org>
PR fortran/66102
* fortran/trans-array.c (gfc_conv_resolve_dependencies):
Break if dependency has been found.
2017-07-23 Thomas Koenig <tkoenig@gcc.gnu.org>
Mikael Morin <mikael@gcc.gnu.org>
PR fortran/66102
* gfortran.dg/realloc_on_assign_28.f90: New test.
[-- Attachment #2: p1.diff --]
[-- Type: text/x-patch, Size: 554 bytes --]
Index: fortran/trans-array.c
===================================================================
--- fortran/trans-array.c (Revision 249936)
+++ fortran/trans-array.c (Arbeitskopie)
@@ -4576,8 +4576,11 @@ gfc_conv_resolve_dependencies (gfc_loopinfo * loop
if (ss_info->type == GFC_SS_REFERENCE
&& gfc_check_dependency (dest_expr, ss_expr, false))
ss_info->data.scalar.needs_temporary = 1;
-
- continue;
+
+ if (nDepend)
+ break;
+ else
+ continue;
}
if (dest_expr->symtree->n.sym != ss_expr->symtree->n.sym)
[-- Attachment #3: realloc_on_assign_28.f90 --]
[-- Type: text/x-fortran, Size: 921 bytes --]
! { dg-do run }
!
! PR fortran/66102
!
! Contributed by Vladimir Fuka <vladimir.fuka@gmail.com>
!
type t
integer,allocatable :: i
end type
type(t) :: e
type(t), allocatable, dimension(:) :: a, b
integer :: chksum = 0
do i=1,3 ! Was 100 in original
e%i = i
chksum = chksum + i
if (.not.allocated(a)) then
a = [e]
b = first_arg([e], [e])
else
call foo
end if
end do
if (sum ([(a(i)%i, i=1,size(a))]) .ne. chksum) call abort
if (any([(a(i)%i, i=1,size(a))] /= [(i, i=1,size(a))])) call abort
if (size(a) /= size(b)) call abort
if (any([(b(i)%i, i=1,size(b))] /= [(i, i=1,size(b))])) call abort
contains
subroutine foo
b = first_arg([b, e], [a, e])
a = [a, e]
end subroutine
elemental function first_arg(arg1, arg2)
type(t), intent(in) :: arg1, arg2
type(t) :: first_arg
first_arg = arg1
end function first_arg
end
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [patch, fortran] Fix another dependency check for reallocation on assignment
2017-07-23 11:27 [patch, fortran] Fix another dependency check for reallocation on assignment Thomas Koenig
@ 2017-07-23 19:47 ` Jerry DeLisle
0 siblings, 0 replies; 2+ messages in thread
From: Jerry DeLisle @ 2017-07-23 19:47 UTC (permalink / raw)
To: Thomas Koenig, fortran, gcc-patches
On 07/23/2017 04:27 AM, Thomas Koenig wrote:
> Hello world,
>
> in PR 66102, I found a patch by Mikael which has never been applied.
> After dusting it off, finding that it looks reasonable and fixes
> the test case in question I'd like to apply this.
>
> Regression-tested. OK for trunk?
>
OK, thanks.
Jerry
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-07-23 19:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-23 11:27 [patch, fortran] Fix another dependency check for reallocation on assignment Thomas Koenig
2017-07-23 19:47 ` 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).