From: Francois-Xavier Coudert Date: Wed, 21 May 2008 16:01:08 +0000 (+0000) Subject: re PR fortran/36257 (SPREAD gives wrong results with array CHARACTER parameters) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=31579a22113e7102520a55c36544c218e5565ed9;p=gcc.git re PR fortran/36257 (SPREAD gives wrong results with array CHARACTER parameters) PR fortran/36257 * gfortran.dg/char_length_12.f90: New test. * iresolve.c (check_charlen_present): Don't force the rank to 1. From-SVN: r135723 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 436142879da..0161a2a79c9 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2008-05-21 Francois-Xavier Coudert + + PR fortran/36257 + * iresolve.c (check_charlen_present): Don't force the rank to 1. + 2008-05-19 Francois-Xavier Coudert PR fortran/36265 diff --git a/gcc/fortran/iresolve.c b/gcc/fortran/iresolve.c index 4b7e17d70f3..94ed4a67baf 100644 --- a/gcc/fortran/iresolve.c +++ b/gcc/fortran/iresolve.c @@ -75,11 +75,8 @@ check_charlen_present (gfc_expr *source) source->rank = 0; } else if (source->expr_type == EXPR_ARRAY) - { - source->ts.cl->length = + source->ts.cl->length = gfc_int_expr (source->value.constructor->expr->value.character.length); - source->rank = 1; - } } /* Helper function for resolving the "mask" argument. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0267b43ff9e..e2e4323a99a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-05-21 Francois-Xavier Coudert + + PR fortran/36257 + * gfortran.dg/char_length_12.f90: New test. + 2008-05-20 Nathan Sidwell * gcc.c-torture/execute/builtins/memops-asm.c: Set inside_main. diff --git a/gcc/testsuite/gfortran.dg/char_length_12.f90 b/gcc/testsuite/gfortran.dg/char_length_12.f90 new file mode 100644 index 00000000000..f22eb6c7229 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/char_length_12.f90 @@ -0,0 +1,12 @@ +! { dg-do run } + + implicit none + character(len=3), dimension(3,3), parameter :: & + p = reshape(["xyz", "abc", "mkl", "vpn", "lsd", "epo", "tgv", & + "bbc", "wto"], [3,3]) + character(len=3), dimension(3,3) :: m1 + + m1 = p + if (any (spread (p, 1, 2) /= spread (m1, 1, 2))) call abort + +end