PR fortran/14067
* trans-const.c (gfc_conv_string_init): Allow variable string
length lower than initialization string length.
From-SVN: r82457
+2004-05-30 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
+
+ PR fortran/14067
+ * trans-const.c (gfc_conv_string_init): Allow variable string
+ length lower than initialization string length.
+
2004-05-30 Paul Brook <paul@codesourcery.com>
PR fortran/15620
}
/* Return a string constant with the given length. Used for static
- initializers. The constant will be padded to the full length. */
+ initializers. The constant will be padded or truncated to match
+ length. */
+
tree
gfc_conv_string_init (tree length, gfc_expr * expr)
{
len = TREE_INT_CST_LOW (length);
slen = expr->value.character.length;
- assert (len >= slen);
- if (len != slen)
+
+ if (len > slen)
{
s = gfc_getmem (len);
memcpy (s, expr->value.character.string, slen);