diff options
author | Tobias Burnus <burnus@net-b.de> | 2006-12-10 20:53:07 +0100 |
---|---|---|
committer | Tobias Burnus <burnus@gcc.gnu.org> | 2006-12-10 20:53:07 +0100 |
commit | ee7e677fdd929eb1b9fd60efa476c86fd0692784 (patch) | |
tree | fd873c228f212288e3d63dae896648e0ca50835b /gcc/fortran/resolve.c | |
parent | 42c1cd8a7ac43e4d324fbd4f6051ec56f83cd00b (diff) | |
download | gcc-ee7e677fdd929eb1b9fd60efa476c86fd0692784.zip gcc-ee7e677fdd929eb1b9fd60efa476c86fd0692784.tar.gz gcc-ee7e677fdd929eb1b9fd60efa476c86fd0692784.tar.bz2 |
re PR fortran/23994 (PROTECTED attribute (F2003) is not implemented)
fortran/
2006-12-10 Tobias Burnus <burnus@net-b.de>
PR fortran/23994
* interface.c (compare_actual_formal): PROTECTED is incompatible
with intent(out).
* symbol.c (check_conflict): Check for PROTECTED conflicts.
(gfc_add_protected): New function.
(gfc_copy_attr): Copy PROTECTED attribute.
* decl.c (match_attr_spec): Add PROTECTED support.
(gfc_match_protected): New function.
* dump-parse-tree.c (gfc_show_attr): Add PROTECTED support.
* gfortran.h (gfc_symbol): Add protected flag.
Add gfc_add_protected prototype.
* expr.c (gfc_check_pointer_assign): Add PROTECTED support.
* module.c (ab_attribute, attr_bits, mio_symbol_attribute,
mio_symbol_attribute):
Add PROTECTED support.
* resolve.c (resolve_equivalence): Add PROTECTED support.
* match.c (gfc_match_assignment,)gfc_match_pointer_assignment:
Check PROTECTED attribute.
* match.h: Add gfc_match_protected prototype.
* parse.c (decode_statement): Match PROTECTED statement.
* primary.c (match_variable): Add PROTECTED support.
testsuite/
2006-12-10 Tobias Burnus <burnus@net-b.de>
PR fortran/23994
* gfortran.dg/protected_1.f90: New test.
* gfortran.dg/protected_2.f90: New test.
* gfortran.dg/protected_3.f90: New test.
* gfortran.dg/protected_4.f90: New test.
* gfortran.dg/protected_5.f90: New test.
* gfortran.dg/protected_6.f90: New test.
From-SVN: r119709
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r-- | gcc/fortran/resolve.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 0690dca..33ef748 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -6632,6 +6632,7 @@ resolve_equivalence_derived (gfc_symbol *derived, gfc_symbol *sym, gfc_expr *e) the preceding objects. A substring shall not have length zero. A derived type shall not have components with default initialization nor shall two objects of an equivalence group be initialized. + Either all or none of the objects shall have an protected attribute. The simple constraints are done in symbol.c(check_conflict) and the rest are implemented here. */ @@ -6646,7 +6647,7 @@ resolve_equivalence (gfc_equiv *eq) locus *last_where = NULL; seq_type eq_type, last_eq_type; gfc_typespec *last_ts; - int object; + int object, cnt_protected; const char *value_name; const char *msg; @@ -6655,6 +6656,8 @@ resolve_equivalence (gfc_equiv *eq) first_sym = eq->expr->symtree->n.sym; + cnt_protected = 0; + for (object = 1; eq; eq = eq->eq, object++) { e = eq->expr; @@ -6726,6 +6729,17 @@ resolve_equivalence (gfc_equiv *eq) sym = e->symtree->n.sym; + if (sym->attr.protected) + cnt_protected++; + if (cnt_protected > 0 && cnt_protected != object) + { + gfc_error ("Either all or none of the objects in the " + "EQUIVALENCE set at %L shall have the " + "PROTECTED attribute", + &e->where); + break; + } + /* An equivalence statement cannot have more than one initialized object. */ if (sym->value) |