PR fortran/24813
* trans-array.c (get_array_ctor_strlen): Remove static attribute.
* trans.h: Add prototype for get_array_ctor_strlen.
* trans-intrinsic.c (gfc_conv_intrinsic_len): Switch on EXPR_ARRAY
and call get_array_ctor_strlen.
2006-05-07 Paul Thomas <pault@gcc.gnu.org>
PR fortran/24813
* gfortran.dg/char_cons_len_1.f90: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@113594
138bc75d-0d04-0410-961f-
82ee72b054a4
+2006-05-07 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/24813
+ * trans-array.c (get_array_ctor_strlen): Remove static attribute.
+ * trans.h: Add prototype for get_array_ctor_strlen.
+ * trans-intrinsic.c (gfc_conv_intrinsic_len): Switch on EXPR_ARRAY
+ and call get_array_ctor_strlen.
+
2006-05-05 Steven G. Kargl <kargls@comcast.net>
* invoke.texi: Update description of -fall-intrinsics
/* Figure out the string length of a character array constructor.
Returns TRUE if all elements are character constants. */
-static bool
+bool
get_array_ctor_strlen (gfc_constructor * c, tree * len)
{
bool is_const;
len = build_int_cst (NULL_TREE, arg->value.character.length);
break;
+ case EXPR_ARRAY:
+ /* Obtain the string length from the function used by
+ trans-array.c(gfc_trans_array_constructor). */
+ len = NULL_TREE;
+ get_array_ctor_strlen (arg->value.constructor, &len);
+ break;
+
default:
if (arg->expr_type == EXPR_VARIABLE
&& (arg->ref == NULL || (arg->ref->next == NULL
extern GTY(()) tree gfc_static_ctors;
void gfc_generate_constructors (void);
+/* Get the string length of an array constructor. */
+bool get_array_ctor_strlen (gfc_constructor *, tree *);
+
/* Generate a runtime error check. */
void gfc_trans_runtime_check (tree, tree, stmtblock_t *);
+2006-05-07 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/24813
+ * gfortran.dg/char_cons_len_1.f90: New test.
+
2006-05-06 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/27427
--- /dev/null
+! { dg-do compile }
+! Tests the fix for PR24813 in which a character array
+! constructor, as an argument for LEN, would cause an ICE.
+!
+ character(11) :: chr1, chr2
+ i = len ((/chr1, chr2, "ggg"/))
+ j = len ((/"abcdefghijk", chr1, chr2/))
+ k = len ((/'hello ','goodbye'/))
+ l = foo ("yes siree, Bob")
+ if (any ((/11,11,7,14/) /= (/i,j,k,l/))) call abort ()
+contains
+ integer function foo (arg)
+ character(*) :: arg
+ character(len(arg)) :: ctor
+ foo = len ((/ctor/))
+ end function foo
+end