re PR fortran/66102 (dependency mishandling with reallocation on assignment)

2017-07-24  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-24  Thomas Koenig  <tkoenig@gcc.gnu.org>
	    Mikael Morin <mikael@gcc.gnu.org>

	PR fortran/66102
	* gfortran.dg/realloc_on_assign_28.f90:  New test.


Co-Authored-By: Mikael Morin <mikael@gcc.gnu.org>

From-SVN: r250471
This commit is contained in:
Thomas Koenig 2017-07-24 09:50:28 +00:00
parent ffe64f24cc
commit 213c3b7b7c
4 changed files with 57 additions and 1 deletions

View file

@ -1,3 +1,10 @@
2017-07-24 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 Alexander Monakov <amonakov@ispras.ru>
* interface.c (pair_cmp): Fix gfc_symbol comparison. Adjust comment.

View file

@ -4577,7 +4577,10 @@ gfc_conv_resolve_dependencies (gfc_loopinfo * loop, gfc_ss * dest,
&& 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)

View file

@ -1,3 +1,9 @@
2017-07-24 Thomas Koenig <tkoenig@gcc.gnu.org>
Mikael Morin <mikael@gcc.gnu.org>
PR fortran/66102
* gfortran.dg/realloc_on_assign_28.f90: New test.
2017-07-23 David Edelsohn <dje.gcc@gmail.com>
* gcc.dg/pr56727-2.c: Limit to powerpc-linux.

View file

@ -0,0 +1,40 @@
! { 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