re PR fortran/15211 (ICE with LEN intrinsic)

fortran/
PR fortran/15211
* trans-intrinsic.c (gfc_conv_intrinsic_len): Deal with arrays
of strings.

testsuite/
PR fortran/15211
* gfortran.fortran-torture/execute/intrinsic_len.f90: Also test
LEN of a character array.

From-SVN: r83126
This commit is contained in:
Tobias Schlüter 2004-06-14 20:50:44 +02:00 committed by Tobias Schlüter
parent f1c3e0a60c
commit 7031baf4de
4 changed files with 26 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2004-05-31 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
PR fortran/15211
* trans-intrinsic.c (gfc_conv_intrinsic_len): Deal with arrays
of strings.
2004-06-14 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de> 2004-06-14 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
PR fortran/15510 PR fortran/15510

View File

@ -1874,8 +1874,12 @@ gfc_conv_intrinsic_len (gfc_se * se, gfc_expr * expr)
break; break;
default: default:
if (arg->expr_type == EXPR_VARIABLE && arg->ref == NULL) if (arg->expr_type == EXPR_VARIABLE && arg->ref == NULL
|| (arg->ref->next == NULL && arg->ref->type == REF_ARRAY))
{ {
/* This doesn't catch all cases.
See http://gcc.gnu.org/ml/fortran/2004-06/msg00165.html
and the surrounding thread. */
sym = arg->symtree->n.sym; sym = arg->symtree->n.sym;
decl = gfc_get_symbol_decl (sym); decl = gfc_get_symbol_decl (sym);
if (decl == current_function_decl && sym->attr.function if (decl == current_function_decl && sym->attr.function

View File

@ -1,3 +1,9 @@
2004-06-14 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
PR fortran/15211
* gfortran.fortran-torture/execute/intrinsic_len.f90: Also test
LEN of a character array.
2004-06-14 Mark Mitchell <mark@codesourcery.com> 2004-06-14 Mark Mitchell <mark@codesourcery.com>
PR c++/15096 PR c++/15096

View File

@ -12,6 +12,7 @@ program test
if ((a .ne. "01234567") .or. (n .ne. 8)) call abort if ((a .ne. "01234567") .or. (n .ne. 8)) call abort
if (len(Tom%name) .ne. 10) call abort if (len(Tom%name) .ne. 10) call abort
call array_test()
end end
function w(i) function w(i)
@ -20,3 +21,11 @@ function w(i)
w = "01234567" w = "01234567"
i = len(w) i = len(w)
end end
! This is the testcase from PR 15211 converted to a subroutine
subroutine array_test
implicit none
character(len=10) a(4)
if (len(a) .NE. 10) call abort()
end subroutine array_test