Commit cba28dad by Jerry DeLisle

re PR fortran/31306 (ICE with implicit character variables)

2007-10-27 Jerry DeLisle <jvdelisle@gcc.gnu.org>

	PR fortran/31306
	* decl.c (char_len_param_value): Add check for conflicting attributes of
	function argument.

From-SVN: r129685
parent 735da29a
2007-10-27 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/31306
* decl.c (char_len_param_value): Add check for conflicting attributes of
function argument.
2007-10-27 Tobias Burnus <burnus@net-b.de> 2007-10-27 Tobias Burnus <burnus@net-b.de>
PR fortran/33862 PR fortran/33862
......
...@@ -566,13 +566,39 @@ match_intent_spec (void) ...@@ -566,13 +566,39 @@ match_intent_spec (void)
static match static match
char_len_param_value (gfc_expr **expr) char_len_param_value (gfc_expr **expr)
{ {
match m;
if (gfc_match_char ('*') == MATCH_YES) if (gfc_match_char ('*') == MATCH_YES)
{ {
*expr = NULL; *expr = NULL;
return MATCH_YES; return MATCH_YES;
} }
return gfc_match_expr (expr); m = gfc_match_expr (expr);
if (m == MATCH_YES && (*expr)->expr_type == EXPR_FUNCTION)
{
if ((*expr)->value.function.actual
&& (*expr)->value.function.actual->expr->symtree)
{
gfc_expr *e;
e = (*expr)->value.function.actual->expr;
if (e->symtree->n.sym->attr.flavor == FL_PROCEDURE
&& e->expr_type == EXPR_VARIABLE)
{
if (e->symtree->n.sym->ts.type == BT_UNKNOWN)
goto syntax;
if (e->symtree->n.sym->ts.type == BT_CHARACTER
&& e->symtree->n.sym->ts.cl
&& e->symtree->n.sym->ts.cl->length->ts.type == BT_UNKNOWN)
goto syntax;
}
}
}
return m;
syntax:
gfc_error ("Conflict in attributes of function argument at %C");
return MATCH_ERROR;
} }
......
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