aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/symbol.c
diff options
context:
space:
mode:
authorErik Edelmann <eedelman@gcc.gnu.org>2006-03-05 19:24:48 +0000
committerErik Edelmann <eedelman@gcc.gnu.org>2006-03-05 19:24:48 +0000
commitaa08038dda94c80126a2ac54e8bab0964a95bf41 (patch)
treed1b0048a6e28bab0dfa55b141c9b8fb3793db643 /gcc/fortran/symbol.c
parent68c9b7d60a71b8ab9e0ebe692f74aedb61a95af1 (diff)
downloadgcc-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/symbol.c')
-rw-r--r--gcc/fortran/symbol.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
index 285c276..e98556d 100644
--- a/gcc/fortran/symbol.c
+++ b/gcc/fortran/symbol.c
@@ -251,6 +251,13 @@ gfc_set_default_type (gfc_symbol * sym, int error_flag, gfc_namespace * ns)
#define conf(a, b) if (attr->a && attr->b) { a1 = a; a2 = b; goto conflict; }
#define conf2(a) if (attr->a) { a2 = a; goto conflict; }
+#define conf_std(a, b, std) if (attr->a && attr->b)\
+ {\
+ a1 = a;\
+ a2 = b;\
+ standard = std;\
+ goto conflict_std;\
+ }
static try
check_conflict (symbol_attribute * attr, const char * name, locus * where)
@@ -268,6 +275,7 @@ check_conflict (symbol_attribute * attr, const char * name, locus * where)
static const char *threadprivate = "THREADPRIVATE";
const char *a1, *a2;
+ int standard;
if (where == NULL)
where = &gfc_current_locus;
@@ -328,7 +336,7 @@ check_conflict (symbol_attribute * attr, const char * name, locus * where)
}
conf (allocatable, pointer);
- conf (allocatable, dummy); /* TODO: Allowed in Fortran 200x. */
+ conf_std (allocatable, dummy, GFC_STD_F2003);
conf (allocatable, function); /* TODO: Allowed in Fortran 200x. */
conf (allocatable, result); /* TODO: Allowed in Fortran 200x. */
conf (elemental, recursive);
@@ -519,10 +527,25 @@ conflict:
a1, a2, name, where);
return FAILURE;
+
+conflict_std:
+ if (name == NULL)
+ {
+ return gfc_notify_std (standard, "In the selected standard, %s attribute "
+ "conflicts with %s attribute at %L", a1, a2,
+ where);
+ }
+ else
+ {
+ return gfc_notify_std (standard, "In the selected standard, %s attribute "
+ "conflicts with %s attribute in '%s' at %L",
+ a1, a2, name, where);
+ }
}
#undef conf
#undef conf2
+#undef conf_std
/* Mark a symbol as referenced. */