diff options
Diffstat (limited to 'gcc/fortran/check.c')
-rw-r--r-- | gcc/fortran/check.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c index 7b71896..feb07f0 100644 --- a/gcc/fortran/check.c +++ b/gcc/fortran/check.c @@ -477,10 +477,13 @@ gfc_check_associated (gfc_expr * pointer, gfc_expr * target) int i; try t; - if (variable_check (pointer, 0) == FAILURE) - return FAILURE; + if (pointer->expr_type == EXPR_VARIABLE) + attr = gfc_variable_attr (pointer, NULL); + else if (pointer->expr_type == EXPR_FUNCTION) + attr = pointer->symtree->n.sym->attr; + else + gcc_assert (0); /* Pointer must be a variable or a function. */ - attr = gfc_variable_attr (pointer, NULL); if (!attr.pointer) { gfc_error ("'%s' argument of '%s' intrinsic at %L must be a POINTER", @@ -489,10 +492,10 @@ gfc_check_associated (gfc_expr * pointer, gfc_expr * target) return FAILURE; } + /* Target argument is optional. */ if (target == NULL) return SUCCESS; - /* Target argument is optional. */ if (target->expr_type == EXPR_NULL) { gfc_error ("NULL pointer at %L is not permitted as actual argument " @@ -501,7 +504,13 @@ gfc_check_associated (gfc_expr * pointer, gfc_expr * target) return FAILURE; } - attr = gfc_variable_attr (target, NULL); + if (target->expr_type == EXPR_VARIABLE) + attr = gfc_variable_attr (target, NULL); + else if (target->expr_type == EXPR_FUNCTION) + attr = target->symtree->n.sym->attr; + else + gcc_assert (0); /* Target must be a variable or a function. */ + if (!attr.pointer && !attr.target) { gfc_error ("'%s' argument of '%s' intrinsic at %L must be a POINTER " |