aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/resolve.c
diff options
context:
space:
mode:
authorTobias Burnus <burnus@gcc.gnu.org>2007-02-20 10:16:58 +0100
committerTobias Burnus <burnus@gcc.gnu.org>2007-02-20 10:16:58 +0100
commit1084b6b03b0d5a46541dcce0f422e02a182bc03e (patch)
tree4b5d08b67d15b7a96d45cb74d7598ffb70448d1f /gcc/fortran/resolve.c
parentc88b0c50f7b26078e9b4c6d7d7749f8de44b1f07 (diff)
downloadgcc-1084b6b03b0d5a46541dcce0f422e02a182bc03e.zip
gcc-1084b6b03b0d5a46541dcce0f422e02a182bc03e.tar.gz
gcc-1084b6b03b0d5a46541dcce0f422e02a182bc03e.tar.bz2
re PR fortran/30783 ("character(*), value" produces SEGV at runtime)
2007-02-20 Tobias Burnus <burnus@net-b.de> PR fortran/30783 * resolve.c (resolve_symbol): Add character dummy VALUE check. From-SVN: r122156
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r--gcc/fortran/resolve.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 84d42ee..8db36b5 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -6153,10 +6153,22 @@ resolve_symbol (gfc_symbol *sym)
if (sym->attr.value && !sym->attr.dummy)
{
gfc_error ("'%s' at %L cannot have the VALUE attribute because "
- "it is not a dummy", sym->name, &sym->declared_at);
+ "it is not a dummy argument", sym->name, &sym->declared_at);
return;
}
+ if (sym->attr.value && sym->ts.type == BT_CHARACTER)
+ {
+ gfc_charlen *cl = sym->ts.cl;
+ if (!cl || !cl->length || cl->length->expr_type != EXPR_CONSTANT)
+ {
+ gfc_error ("Character dummy variable '%s' at %L with VALUE "
+ "attribute must have constant length",
+ sym->name, &sym->declared_at);
+ return;
+ }
+ }
+
/* If a derived type symbol has reached this point, without its
type being declared, we have an error. Notice that most
conditions that produce undefined derived types have already