diff options
author | Erik Edelmann <eedelman@gcc.gnu.org> | 2006-03-05 19:24:48 +0000 |
---|---|---|
committer | Erik Edelmann <eedelman@gcc.gnu.org> | 2006-03-05 19:24:48 +0000 |
commit | aa08038dda94c80126a2ac54e8bab0964a95bf41 (patch) | |
tree | d1b0048a6e28bab0dfa55b141c9b8fb3793db643 /gcc/fortran/interface.c | |
parent | 68c9b7d60a71b8ab9e0ebe692f74aedb61a95af1 (diff) | |
download | gcc-aa08038dda94c80126a2ac54e8bab0964a95bf41.zip gcc-aa08038dda94c80126a2ac54e8bab0964a95bf41.tar.gz gcc-aa08038dda94c80126a2ac54e8bab0964a95bf41.tar.bz2 |
re PR fortran/16136 (Conflicting attributes ALLOCATABLE, DUMMY (F2003))
fortran/
2005-03-05 Erik Edelmann <eedelman@gcc.gnu.org>
PR fortran/16136
* symbol.c (conf_std): New macro.
(check_conflict): Use it to allow ALLOCATABLE dummy
arguments for F2003.
* trans-expr.c (gfc_conv_function_call): Pass the
address of the array descriptor when dummy argument is
ALLOCATABLE.
* interface.c (compare_allocatable): New function.
(compare_actual_formal): Use it.
resolve.c (resolve_deallocate_expr,
resolve_allocate_expr): Check that INTENT(IN) variables
aren't (de)allocated.
* gfortran.texi (Fortran 2003 status): List ALLOCATABLE
dummy arguments as supported.
testsuite/
2005-03-05 Erik Edelmann <eedelman@gcc.gnu.org>
PR fortran/16136
* allocatable_dummy_1.f90: New.
* allocatable_dummy_2.f90: New.
From-SVN: r111741
Diffstat (limited to 'gcc/fortran/interface.c')
-rw-r--r-- | gcc/fortran/interface.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c index 7c86279..f4e522a 100644 --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -1065,6 +1065,26 @@ symbol_rank (gfc_symbol * sym) /* Given a symbol of a formal argument list and an expression, if the + formal argument is allocatable, check that the actual argument is + allocatable. Returns nonzero if compatible, zero if not compatible. */ + +static int +compare_allocatable (gfc_symbol * formal, gfc_expr * actual) +{ + symbol_attribute attr; + + if (formal->attr.allocatable) + { + attr = gfc_expr_attr (actual); + if (!attr.allocatable) + return 0; + } + + return 1; +} + + +/* Given a symbol of a formal argument list and an expression, if the formal argument is a pointer, see if the actual argument is a pointer. Returns nonzero if compatible, zero if not compatible. */ @@ -1276,6 +1296,15 @@ compare_actual_formal (gfc_actual_arglist ** ap, return 0; } + if (a->expr->expr_type != EXPR_NULL + && compare_allocatable (f->sym, a->expr) == 0) + { + if (where) + gfc_error ("Actual argument for '%s' must be ALLOCATABLE at %L", + f->sym->name, &a->expr->where); + return 0; + } + /* Check intent = OUT/INOUT for definable actual argument. */ if (a->expr->expr_type != EXPR_VARIABLE && (f->sym->attr.intent == INTENT_OUT |