diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 47b7e24df84c531b6af9d5f37f84071ef94ea7b5..04e529005f1453fa74a7dc83fef581684dd95aba 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -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>
 
 	PR fortran/15510
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index e2c1b7e1529f45e7bf3c2df59dcc62005878b79c..67b6cc46dad77540be114e5ddf70ef62d5c51e01 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -1874,8 +1874,12 @@ gfc_conv_intrinsic_len (gfc_se * se, gfc_expr * expr)
       break;
 
     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;
 	    decl = gfc_get_symbol_decl (sym);
 	    if (decl == current_function_decl && sym->attr.function
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0bff3abb8defd6dc9366b8baf29c95bcd1cff836..36cb478b01c5d51c251cde08d4e2b2e9ae79042e 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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>
 
 	PR c++/15096
diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_len.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_len.f90
index 6721738608fe4d71ff2589be1d8544edf97f2811..9db8d407a941e9c761a8fc008025d4dbcfb8658b 100644
--- a/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_len.f90
+++ b/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_len.f90
@@ -12,6 +12,7 @@ program test
 
   if ((a .ne. "01234567") .or. (n .ne. 8)) call abort
   if (len(Tom%name) .ne. 10) call abort
+  call array_test()
 end
 
 function w(i)
@@ -20,3 +21,11 @@ function w(i)
   w = "01234567"
   i = len(w)
 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
+