diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fortran/trans-array.c | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/array_constructor_18.f90 | 19 |
4 files changed, 37 insertions, 0 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 78e4852..4103e25 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2007-08-18 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/32875 + * trans-array.c (get_array_ctor_strlen): Set the character + length of a zero length array to zero. + 2007-08-16 Tobias Burnus <burnus@net-b.de> PR fortran/33072 diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 31d177b..f6b4751 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -1421,6 +1421,13 @@ get_array_ctor_strlen (stmtblock_t *block, gfc_constructor * c, tree * len) bool is_const; is_const = TRUE; + + if (c == NULL) + { + *len = build_int_cstu (gfc_charlen_type_node, 0); + return is_const; + } + for (; c; c = c->next) { switch (c->expr->expr_type) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e09738c..3c01d60 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2007-08-18 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/32875 + * gfortran.dg/array_constructor_18.f90: New test. + 2007-08-17 Andrew Pinski <andrew_pinski@playstation.sony.com> PR c++/28989 diff --git a/gcc/testsuite/gfortran.dg/array_constructor_18.f90 b/gcc/testsuite/gfortran.dg/array_constructor_18.f90 new file mode 100644 index 0000000..246f448 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/array_constructor_18.f90 @@ -0,0 +1,19 @@ +! { dg-do compile } +! Tests the fix for PR32875, in which the character length for the +! array constructor would get lost in simplification and would lead +! the error 'Not Implemented: complex character array constructor'. +! +! Contributed by Joost VandeVondele <jv244@cam.ac.uk> +! + call foo ((/(S1(i),i=1,3,-1)/)) +CONTAINS + FUNCTION S1(i) + CHARACTER(LEN=1) :: S1 + INTEGER :: I + S1="123456789"(i:i) + END FUNCTION S1 + subroutine foo (chr) + character(1) :: chr(:) + print *, chr + end subroutine +END |