Commit 8e54f139 by Tobias Burnus

[multiple changes]

2012-09-03  Alessandro Fanfarillo  <fanfarillo.gcc@gmail.com>
            Tobias Burnus  <burnus@net-b.de>

        PR fortran/37336
        * gfortran.h (symbol_attribute): Add artificial.
        * module.c (mio_symbol_attribute): Handle attr.artificial
        * class.c (gfc_build_class_symbol): Defer creation of the vtab
        if the DT has finalizers, mark generated symbols as
        attr.artificial.
        (has_finalizer_component, finalize_component,
        finalization_scalarizer, generate_finalization_wrapper):
        New static functions.
        (gfc_find_derived_vtab): Add _final component and call
        generate_finalization_wrapper.
        * dump-parse-tree.c (show_f2k_derived): Use resolved
        proc_tree->n.sym rather than unresolved proc_sym.
        (show_attr): Handle attr.artificial.
        * resolve.c (gfc_resolve_finalizers): Ensure that the vtab
        * exists.
        (resolve_fl_derived): Resolve finalizers before
        generating the vtab.
        (resolve_symbol): Also allow assumed-rank arrays with CONTIGUOUS;
        skip artificial symbols.
        (resolve_fl_derived0): Skip artificial symbols.

2012-09-03  Tobias Burnus  <burnus@net-b.de>

        PR fortran/51632
        * gfortran.dg/coarray_class_1.f90: New.

From-SVN: r190869
parent 2e4a4bbd
2012-09-03 Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>
Tobias Burnus <burnus@net-b.de>
PR fortran/37336
* gfortran.h (symbol_attribute): Add artificial.
* module.c (mio_symbol_attribute): Handle attr.artificial
* class.c (gfc_build_class_symbol): Defer creation of the vtab
if the DT has finalizers, mark generated symbols as
attr.artificial.
(has_finalizer_component, finalize_component,
finalization_scalarizer, generate_finalization_wrapper):
New static functions.
(gfc_find_derived_vtab): Add _final component and call
generate_finalization_wrapper.
* dump-parse-tree.c (show_f2k_derived): Use resolved
proc_tree->n.sym rather than unresolved proc_sym.
(show_attr): Handle attr.artificial.
* resolve.c (gfc_resolve_finalizers): Ensure that the vtab exists.
(resolve_fl_derived): Resolve finalizers before
generating the vtab.
(resolve_symbol): Also allow assumed-rank arrays with CONTIGUOUS;
skip artificial symbols.
(resolve_fl_derived0): Skip artificial symbols.
2012-09-02 Tobias Burnus <burnus@net-b.de> 2012-09-02 Tobias Burnus <burnus@net-b.de>
PR fortran/54426 PR fortran/54426
......
...@@ -613,6 +613,8 @@ show_attr (symbol_attribute *attr, const char * module) ...@@ -613,6 +613,8 @@ show_attr (symbol_attribute *attr, const char * module)
if (attr->save != SAVE_NONE) if (attr->save != SAVE_NONE)
fprintf (dumpfile, "%s", gfc_code2string (save_status, attr->save)); fprintf (dumpfile, "%s", gfc_code2string (save_status, attr->save));
if (attr->artificial)
fputs (" ARTIFICIAL", dumpfile);
if (attr->allocatable) if (attr->allocatable)
fputs (" ALLOCATABLE", dumpfile); fputs (" ALLOCATABLE", dumpfile);
if (attr->asynchronous) if (attr->asynchronous)
...@@ -788,7 +790,7 @@ show_f2k_derived (gfc_namespace* f2k) ...@@ -788,7 +790,7 @@ show_f2k_derived (gfc_namespace* f2k)
for (f = f2k->finalizers; f; f = f->next) for (f = f2k->finalizers; f; f = f->next)
{ {
show_indent (); show_indent ();
fprintf (dumpfile, "FINAL %s", f->proc_sym->name); fprintf (dumpfile, "FINAL %s", f->proc_tree->n.sym->name);
} }
/* Type-bound procedures. */ /* Type-bound procedures. */
......
...@@ -761,6 +761,10 @@ typedef struct ...@@ -761,6 +761,10 @@ typedef struct
/* Set if a function must always be referenced by an explicit interface. */ /* Set if a function must always be referenced by an explicit interface. */
unsigned always_explicit:1; unsigned always_explicit:1;
/* Set if the symbol is generated and, hence, standard violations
shouldn't be flaged. */
unsigned artificial:1;
/* Set if the symbol has been referenced in an expression. No further /* Set if the symbol has been referenced in an expression. No further
modification of type or type parameters is permitted. */ modification of type or type parameters is permitted. */
unsigned referenced:1; unsigned referenced:1;
......
...@@ -1844,13 +1844,14 @@ typedef enum ...@@ -1844,13 +1844,14 @@ typedef enum
AB_IS_BIND_C, AB_IS_C_INTEROP, AB_IS_ISO_C, AB_ABSTRACT, AB_ZERO_COMP, AB_IS_BIND_C, AB_IS_C_INTEROP, AB_IS_ISO_C, AB_ABSTRACT, AB_ZERO_COMP,
AB_IS_CLASS, AB_PROCEDURE, AB_PROC_POINTER, AB_ASYNCHRONOUS, AB_CODIMENSION, AB_IS_CLASS, AB_PROCEDURE, AB_PROC_POINTER, AB_ASYNCHRONOUS, AB_CODIMENSION,
AB_COARRAY_COMP, AB_VTYPE, AB_VTAB, AB_CONTIGUOUS, AB_CLASS_POINTER, AB_COARRAY_COMP, AB_VTYPE, AB_VTAB, AB_CONTIGUOUS, AB_CLASS_POINTER,
AB_IMPLICIT_PURE AB_IMPLICIT_PURE, AB_ARTIFICIAL
} }
ab_attribute; ab_attribute;
static const mstring attr_bits[] = static const mstring attr_bits[] =
{ {
minit ("ALLOCATABLE", AB_ALLOCATABLE), minit ("ALLOCATABLE", AB_ALLOCATABLE),
minit ("ARTIFICIAL", AB_ARTIFICIAL),
minit ("ASYNCHRONOUS", AB_ASYNCHRONOUS), minit ("ASYNCHRONOUS", AB_ASYNCHRONOUS),
minit ("DIMENSION", AB_DIMENSION), minit ("DIMENSION", AB_DIMENSION),
minit ("CODIMENSION", AB_CODIMENSION), minit ("CODIMENSION", AB_CODIMENSION),
...@@ -1975,6 +1976,8 @@ mio_symbol_attribute (symbol_attribute *attr) ...@@ -1975,6 +1976,8 @@ mio_symbol_attribute (symbol_attribute *attr)
{ {
if (attr->allocatable) if (attr->allocatable)
MIO_NAME (ab_attribute) (AB_ALLOCATABLE, attr_bits); MIO_NAME (ab_attribute) (AB_ALLOCATABLE, attr_bits);
if (attr->artificial)
MIO_NAME (ab_attribute) (AB_ARTIFICIAL, attr_bits);
if (attr->asynchronous) if (attr->asynchronous)
MIO_NAME (ab_attribute) (AB_ASYNCHRONOUS, attr_bits); MIO_NAME (ab_attribute) (AB_ASYNCHRONOUS, attr_bits);
if (attr->dimension) if (attr->dimension)
...@@ -2090,6 +2093,9 @@ mio_symbol_attribute (symbol_attribute *attr) ...@@ -2090,6 +2093,9 @@ mio_symbol_attribute (symbol_attribute *attr)
case AB_ALLOCATABLE: case AB_ALLOCATABLE:
attr->allocatable = 1; attr->allocatable = 1;
break; break;
case AB_ARTIFICIAL:
attr->artificial = 1;
break;
case AB_ASYNCHRONOUS: case AB_ASYNCHRONOUS:
attr->asynchronous = 1; attr->asynchronous = 1;
break; break;
......
...@@ -11222,6 +11222,7 @@ error: ...@@ -11222,6 +11222,7 @@ error:
gfc_error ("Finalization at %L is not yet implemented", gfc_error ("Finalization at %L is not yet implemented",
&derived->declared_at); &derived->declared_at);
gfc_find_derived_vtab (derived);
return result; return result;
} }
...@@ -11925,6 +11926,9 @@ resolve_fl_derived0 (gfc_symbol *sym) ...@@ -11925,6 +11926,9 @@ resolve_fl_derived0 (gfc_symbol *sym)
for ( ; c != NULL; c = c->next) for ( ; c != NULL; c = c->next)
{ {
if (c->attr.artificial)
continue;
/* See PRs 51550, 47545, 48654, 49050, 51075 - and 45170. */ /* See PRs 51550, 47545, 48654, 49050, 51075 - and 45170. */
if (c->ts.type == BT_CHARACTER && c->ts.deferred && !c->attr.function) if (c->ts.type == BT_CHARACTER && c->ts.deferred && !c->attr.function)
{ {
...@@ -12321,6 +12325,10 @@ resolve_fl_derived (gfc_symbol *sym) ...@@ -12321,6 +12325,10 @@ resolve_fl_derived (gfc_symbol *sym)
&sym->declared_at) == FAILURE) &sym->declared_at) == FAILURE)
return FAILURE; return FAILURE;
/* Resolve the finalizer procedures. */
if (gfc_resolve_finalizers (sym) == FAILURE)
return FAILURE;
if (sym->attr.is_class && sym->ts.u.derived == NULL) if (sym->attr.is_class && sym->ts.u.derived == NULL)
{ {
/* Fix up incomplete CLASS symbols. */ /* Fix up incomplete CLASS symbols. */
...@@ -12341,10 +12349,6 @@ resolve_fl_derived (gfc_symbol *sym) ...@@ -12341,10 +12349,6 @@ resolve_fl_derived (gfc_symbol *sym)
if (resolve_typebound_procedures (sym) == FAILURE) if (resolve_typebound_procedures (sym) == FAILURE)
return FAILURE; return FAILURE;
/* Resolve the finalizer procedures. */
if (gfc_resolve_finalizers (sym) == FAILURE)
return FAILURE;
return SUCCESS; return SUCCESS;
} }
...@@ -12541,6 +12545,9 @@ resolve_symbol (gfc_symbol *sym) ...@@ -12541,6 +12545,9 @@ resolve_symbol (gfc_symbol *sym)
symbol_attribute class_attr; symbol_attribute class_attr;
gfc_array_spec *as; gfc_array_spec *as;
if (sym->attr.artificial)
return;
if (sym->attr.flavor == FL_UNKNOWN if (sym->attr.flavor == FL_UNKNOWN
|| (sym->attr.flavor == FL_PROCEDURE && !sym->attr.intrinsic || (sym->attr.flavor == FL_PROCEDURE && !sym->attr.intrinsic
&& !sym->attr.generic && !sym->attr.external && !sym->attr.generic && !sym->attr.external
...@@ -12674,11 +12681,12 @@ resolve_symbol (gfc_symbol *sym) ...@@ -12674,11 +12681,12 @@ resolve_symbol (gfc_symbol *sym)
/* F2008, C530. */ /* F2008, C530. */
if (sym->attr.contiguous if (sym->attr.contiguous
&& (!class_attr.dimension && (!class_attr.dimension
|| (as->type != AS_ASSUMED_SHAPE && !class_attr.pointer))) || (as->type != AS_ASSUMED_SHAPE && as->type != AS_ASSUMED_RANK
&& !class_attr.pointer)))
{ {
gfc_error ("'%s' at %L has the CONTIGUOUS attribute but is not an " gfc_error ("'%s' at %L has the CONTIGUOUS attribute but is not an "
"array pointer or an assumed-shape array", sym->name, "array pointer or an assumed-shape or assumed-rank array",
&sym->declared_at); sym->name, &sym->declared_at);
return; return;
} }
......
2012-09-03 Tobias Burnus <burnus@net-b.de>
PR fortran/51632
* gfortran.dg/coarray_class_1.f90: New.
2012-09-02 Uros Bizjak <ubizjak@gmail.com> 2012-09-02 Uros Bizjak <ubizjak@gmail.com>
PR target/49206 PR target/49206
......
! { dg-do compile }
! { dg-options "-fcoarray=single" }
!
! PR fortran/51632
!
! Was rejected before as __def_init and __copy were
! resolved and coarray components aren't valid in this
! context
!
module periodic_2nd_order_module
implicit none
type periodic_2nd_order
real, allocatable :: global_f(:)[:]
contains
procedure :: output
end type
contains
subroutine output (this)
class(periodic_2nd_order), intent(in) :: this
end subroutine
end module
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment