Commit 94716287 by Tobias Schlüter Committed by Tobias Schlüter

re PR fortran/14067 (no warning when character data statement overflows declared size)

PR fortran/14067
* trans-const.c (gfc_conv_string_init): Allow variable string
length lower than initialization string length.

From-SVN: r82457
parent d22b7e14
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
......
......@@ -90,7 +90,9 @@ gfc_build_string_const (int length, const char *s)
}
/* 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)
{
......@@ -106,8 +108,8 @@ 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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment