diff options
author | burnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-06-21 14:15:56 +0000 |
---|---|---|
committer | burnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-06-21 14:15:56 +0000 |
commit | b3c3927c05d8ad190b76c56ae6020e1650b85a97 (patch) | |
tree | 021d3ff6f25beca1bdf707ef4ee39618d4492016 /gcc/fortran/resolve.c | |
parent | f73ee678e9c17fc3bcbe50617650860a4de49f0f (diff) | |
download | gcc-b3c3927c05d8ad190b76c56ae6020e1650b85a97.tar.gz |
2010-06-20 Tobias Burnus <burnus@net-b.de>
PR fortran/40632
* interface.c (compare_parameter): Add gfc_is_simply_contiguous
checks.
* symbol.c (gfc_add_contiguous): New function.
(gfc_copy_attr, check_conflict): Handle contiguous attribute.
* decl.c (match_attr_spec): Ditto.
(gfc_match_contiguous): New function.
* resolve.c (resolve_fl_derived, resolve_symbol): Handle
contiguous.
* gfortran.h (symbol_attribute): Add contiguous.
(gfc_is_simply_contiguous): Add prototype.
(gfc_add_contiguous): Add prototype.
* match.h (gfc_match_contiguous): Add prototype.
* parse.c (decode_specification_statement,
decode_statement): Handle contiguous attribute.
* expr.c (gfc_is_simply_contiguous): New function.
* dump-parse-tree.c (show_attr): Handle contiguous.
* module.c (ab_attribute, attr_bits, mio_symbol_attribute):
Ditto.
* trans-expr.c (gfc_add_interface_mapping): Copy
attr.contiguous.
* trans-array.c (gfc_conv_descriptor_stride_get,
gfc_conv_array_parameter): Handle contiguous arrays.
* trans-types.c (gfc_build_array_type, gfc_build_array_type,
gfc_sym_type, gfc_get_derived_type, gfc_get_array_descr_info):
Ditto.
* trans.h (gfc_array_kind): Ditto.
* trans-decl.c (gfc_get_symbol_decl): Ditto.
2010-06-20 Tobias Burnus <burnus@net-b.de>
PR fortran/40632
* gfortran.dg/contiguous_1.f90: New.
* gfortran.dg/contiguous_2.f90: New.
* gfortran.dg/contiguous_3.f90: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161079 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r-- | gcc/fortran/resolve.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 2f05b23b02f..20def447767 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -10826,6 +10826,14 @@ resolve_fl_derived (gfc_symbol *sym) return FAILURE; } + /* F2008, C448. */ + if (c->attr.contiguous && (!c->attr.dimension || !c->attr.pointer)) + { + gfc_error ("Component '%s' at %L has the CONTIGUOUS attribute but " + "is not an array pointer", c->name, &c->loc); + return FAILURE; + } + if (c->attr.proc_pointer && c->ts.interface) { if (c->ts.interface->attr.procedure && !sym->attr.vtype) @@ -11397,6 +11405,7 @@ resolve_symbol (gfc_symbol *sym) sym->attr.pure = ifc->attr.pure; sym->attr.elemental = ifc->attr.elemental; sym->attr.dimension = ifc->attr.dimension; + sym->attr.contiguous = ifc->attr.contiguous; sym->attr.recursive = ifc->attr.recursive; sym->attr.always_explicit = ifc->attr.always_explicit; sym->attr.ext_attr |= ifc->attr.ext_attr; @@ -11442,6 +11451,18 @@ resolve_symbol (gfc_symbol *sym) return; } + + /* F2008, C530. */ + if (sym->attr.contiguous + && (!sym->attr.dimension || (sym->as->type != AS_ASSUMED_SHAPE + && !sym->attr.pointer))) + { + gfc_error ("'%s' at %L has the CONTIGUOUS attribute but is not an " + "array pointer or an assumed-shape array", sym->name, + &sym->declared_at); + return; + } + if (sym->attr.flavor == FL_DERIVED && resolve_fl_derived (sym) == FAILURE) return; @@ -11500,6 +11521,7 @@ resolve_symbol (gfc_symbol *sym) sym->attr.dimension = sym->result->attr.dimension; sym->attr.pointer = sym->result->attr.pointer; sym->attr.allocatable = sym->result->attr.allocatable; + sym->attr.contiguous = sym->result->attr.contiguous; } } } |