Skip to content

Commit

Permalink
re PR fortran/55789 (Needless realloc with array constructor.)
Browse files Browse the repository at this point in the history
2013-02-06 Paul Thomas  <[email protected]>

	PR fortran/55789
	* trans-array.c (trans_array_constructor): Remove condition
	'dynamic' = true if the loop ubound is a VAR_DECL.

2013-02-06 Paul Thomas  <[email protected]>

	PR fortran/55789
	* gfortran.dg/array_constructor_41.f90: New test.

From-SVN: r195815
  • Loading branch information
Paul Thomas committed Feb 6, 2013
1 parent c362c67 commit d0c4e31
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 3 deletions.
6 changes: 6 additions & 0 deletions gcc/fortran/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2013-02-06 Paul Thomas <[email protected]>

PR fortran/55789
* trans-array.c (trans_array_constructor): Remove condition
'dynamic' = true if the loop ubound is a VAR_DECL.

2013-02-04 Paul Thomas <[email protected]>

PR fortran/56008
Expand Down
3 changes: 0 additions & 3 deletions gcc/fortran/trans-array.c
Original file line number Diff line number Diff line change
Expand Up @@ -2307,9 +2307,6 @@ trans_array_constructor (gfc_ss * ss, locus * where)
}
}

if (TREE_CODE (*loop_ubound0) == VAR_DECL)
dynamic = true;

gfc_trans_create_temp_array (&outer_loop->pre, &outer_loop->post, ss, type,
NULL_TREE, dynamic, true, false, where);

Expand Down
5 changes: 5 additions & 0 deletions gcc/testsuite/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2013-02-06 Paul Thomas <[email protected]>

PR fortran/55789
* gfortran.dg/array_constructor_41.f90: New test.

2013-02-06 Janus Weil <[email protected]>

PR fortran/55978
Expand Down
33 changes: 33 additions & 0 deletions gcc/testsuite/gfortran.dg/array_constructor_41.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
! { dg-do compile }
! { dg-options "-fdump-tree-original" }
! Test fix for PR55789
!
! Contributed by Joost VandVandole <[email protected]>
!
MODULE M1
CONTAINS
SUBROUTINE cp_1d_i4_sort(arr)
INTEGER(kind=4), DIMENSION(:), &
INTENT(inout) :: arr
arr = (/ (i, i = 1, SIZE(arr)) /)
END SUBROUTINE
END MODULE M1

PROGRAM TEST
USE M1
INTEGER :: arr(1)
INTERFACE
SUBROUTINE mtrace() BIND(C,name="mtrace")
END SUBROUTINE
END INTERFACE
INTERFACE
SUBROUTINE muntrace() BIND(C,name="muntrace")
END SUBROUTINE
END INTERFACE
CALL mtrace()
CALL cp_1d_i4_sort(arr)
CALL muntrace()
END

! { dg-final { scan-tree-dump-times "realloc" 0 "original" } }
! { dg-final { cleanup-tree-dump "original" } }

0 comments on commit d0c4e31

Please sign in to comment.