Commit 4ee822df by Louis Krupp Committed by Louis Krupp

[multiple changes]

2016-10-06  Louis Krupp <louis.krupp@zoho.com>

	* gfortran.dg/pr69955.f90: New test.

2016-10-06  Louis Krupp  <louis.krupp@zoho.com>

	PR fortran/69955
	* trans-array.c (gfc_conv_expr_descriptor): Don't allocate
	components if it's not necessary.

From-SVN: r240851
parent ac193ee7
2016-10-06 Louis Krupp <louis.krupp@zoho.com>
PR fortran/69955
* trans-array.c (gfc_conv_expr_descriptor): Don't allocate
components if it's not necessary.
2016-10-05 Louis Krupp <louis.krupp@zoho.com>
PR fortran/57910
* trans-expr.c (gfc_add_interface_mapping): Don't try to
dereference call-by-value scalar argument
dereference call-by-value scalar argument.
2016-10-05 Steven G. Kargl <kargls@gcc.gnu.org>
......
......@@ -6963,6 +6963,7 @@ gfc_conv_expr_descriptor (gfc_se *se, gfc_expr *expr)
/* TODO: Optimize passing function return values. */
gfc_se lse;
gfc_se rse;
bool deep_copy;
/* Start the copying loops. */
gfc_mark_ss_chain_used (loop.temp_ss, 1);
......@@ -6993,9 +6994,12 @@ gfc_conv_expr_descriptor (gfc_se *se, gfc_expr *expr)
gfc_add_block_to_block (&block, &lse.pre);
lse.string_length = rse.string_length;
deep_copy = !se->data_not_needed
&& (expr->expr_type == EXPR_VARIABLE
|| expr->expr_type == EXPR_ARRAY);
tmp = gfc_trans_scalar_assign (&lse, &rse, expr->ts,
expr->expr_type == EXPR_VARIABLE
|| expr->expr_type == EXPR_ARRAY, false);
deep_copy, false);
gfc_add_expr_to_block (&block, tmp);
/* Finish the copying loops. */
......
2016-10-06 Louis Krupp <louis.krupp@zoho.com>
* gfortran.dg/pr69955.f90: New test.
2016_10-06 Louis Krupp <louis.krupp@zoho.com>
PR fortran/57910
......
! { dg-do run }
! { dg-options "-fdump-tree-original" }
program p
implicit none
type :: t1
integer, allocatable :: t(:)
end type t1
type :: t2
type(t1), allocatable :: x1(:)
end type t2
type(t2) :: var(10)
integer :: i
do i= 1, 10
allocate(var(i)%x1(100))
allocate(var(i)%x1(1)%t(100))
enddo
open(unit = 37, file = "/dev/null", status = "old")
call s(1)
close(unit = 37)
do i=1,10
deallocate(var(i)%x1)
enddo
contains
subroutine s(counter)
implicit none
integer, intent(in) :: counter
integer :: i, j, n
do j=1, counter
n = size( [ ( var(i)%x1 , i = 1, size(var) ) ] )
write(unit = 37, fmt = '(i5)') n
enddo
end subroutine
end program p
! { dg-final { scan-tree-dump-times "__builtin_malloc" 4 "original" } }
! { dg-final { scan-tree-dump-times "__builtin_free" 4 "original" } }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment