Skip to content

Commit 4a90ae5

Browse files
author
Feng Wang
committed
[multiple changes]
2005-07-14 Steven G. Kargl <[email protected]> * gfortran.dg/char_array_constructor.f90: New test. 2005-07-14 Feng Wang <[email protected]> Steven G. Kargl <[email protected]> * array.c (resolve_character_array_constructor): Allocate gfc_charlen for the array and attach to namespace list for automatic deallocation. From-SVN: r102002
1 parent 0063a82 commit 4a90ae5

File tree

4 files changed

+33
-3
lines changed

4 files changed

+33
-3
lines changed

gcc/fortran/ChangeLog

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2005-07-14 Feng Wang <[email protected]>
2+
Steven G. Kargl <[email protected]>
3+
4+
* array.c (resolve_character_array_constructor): Allocate gfc_charlen
5+
for the array and attach to namespace list for automatic deallocation.
6+
17
2005-07-13 Andreas Schwab <[email protected]>
28

39
* Make-lang.in (fortran/dependency.o): Depend on

gcc/fortran/array.c

+8-3
Original file line numberDiff line numberDiff line change
@@ -1529,7 +1529,14 @@ resolve_character_array_constructor (gfc_expr * expr)
15291529

15301530
max_length = -1;
15311531

1532-
if (expr->ts.cl == NULL || expr->ts.cl->length == NULL)
1532+
if (expr->ts.cl == NULL)
1533+
{
1534+
expr->ts.cl = gfc_get_charlen ();
1535+
expr->ts.cl->next = gfc_current_ns->cl_list;
1536+
gfc_current_ns->cl_list = expr->ts.cl;
1537+
}
1538+
1539+
if (expr->ts.cl->length == NULL)
15331540
{
15341541
/* Find the maximum length of the elements. Do nothing for variable array
15351542
constructor. */
@@ -1542,8 +1549,6 @@ resolve_character_array_constructor (gfc_expr * expr)
15421549
if (max_length != -1)
15431550
{
15441551
/* Update the character length of the array constructor. */
1545-
if (expr->ts.cl == NULL)
1546-
expr->ts.cl = gfc_get_charlen ();
15471552
expr->ts.cl->length = gfc_int_expr (max_length);
15481553
/* Update the element constructors. */
15491554
for (p = expr->value.constructor; p; p = p->next)

gcc/testsuite/ChangeLog

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2005-07-14 Steven G. Kargl <[email protected]>
2+
3+
* gfortran.dg/char_array_constructor.f90: New test.
4+
15
2005-07-13 Paul Thomas <[email protected]>
26

37
* gfortran.dg/past_eor.f90: New.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
! { dg-do run }
2+
module z
3+
integer :: i
4+
character(6) :: a(2) = (/ ('main ' , i = 1, 2) /)
5+
character(6) :: b(2) = (/ 'abcd ' , 'efghij' /)
6+
end module
7+
8+
program y
9+
use z
10+
if (a(1) /= 'main ') call abort
11+
if (a(2) /= 'main ') call abort
12+
if (b(1) /= 'abcd ') call abort
13+
if (b(2) /= 'efghij') call abort
14+
end program y
15+

0 commit comments

Comments
 (0)