Skip to content

Commit d0c4e31

Browse files
author
Paul Thomas
committed
re PR fortran/55789 (Needless realloc with array constructor.)
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
1 parent c362c67 commit d0c4e31

File tree

4 files changed

+44
-3
lines changed

4 files changed

+44
-3
lines changed

gcc/fortran/ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2013-02-06 Paul Thomas <[email protected]>
2+
3+
PR fortran/55789
4+
* trans-array.c (trans_array_constructor): Remove condition
5+
'dynamic' = true if the loop ubound is a VAR_DECL.
6+
17
2013-02-04 Paul Thomas <[email protected]>
28

39
PR fortran/56008

gcc/fortran/trans-array.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2307,9 +2307,6 @@ trans_array_constructor (gfc_ss * ss, locus * where)
23072307
}
23082308
}
23092309

2310-
if (TREE_CODE (*loop_ubound0) == VAR_DECL)
2311-
dynamic = true;
2312-
23132310
gfc_trans_create_temp_array (&outer_loop->pre, &outer_loop->post, ss, type,
23142311
NULL_TREE, dynamic, true, false, where);
23152312

gcc/testsuite/ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2013-02-06 Paul Thomas <[email protected]>
2+
3+
PR fortran/55789
4+
* gfortran.dg/array_constructor_41.f90: New test.
5+
16
2013-02-06 Janus Weil <[email protected]>
27

38
PR fortran/55978
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
! { dg-do compile }
2+
! { dg-options "-fdump-tree-original" }
3+
! Test fix for PR55789
4+
!
5+
! Contributed by Joost VandVandole <[email protected]>
6+
!
7+
MODULE M1
8+
CONTAINS
9+
SUBROUTINE cp_1d_i4_sort(arr)
10+
INTEGER(kind=4), DIMENSION(:), &
11+
INTENT(inout) :: arr
12+
arr = (/ (i, i = 1, SIZE(arr)) /)
13+
END SUBROUTINE
14+
END MODULE M1
15+
16+
PROGRAM TEST
17+
USE M1
18+
INTEGER :: arr(1)
19+
INTERFACE
20+
SUBROUTINE mtrace() BIND(C,name="mtrace")
21+
END SUBROUTINE
22+
END INTERFACE
23+
INTERFACE
24+
SUBROUTINE muntrace() BIND(C,name="muntrace")
25+
END SUBROUTINE
26+
END INTERFACE
27+
CALL mtrace()
28+
CALL cp_1d_i4_sort(arr)
29+
CALL muntrace()
30+
END
31+
32+
! { dg-final { scan-tree-dump-times "realloc" 0 "original" } }
33+
! { dg-final { cleanup-tree-dump "original" } }

0 commit comments

Comments
 (0)