diff options
author | Janus Weil <janus@gcc.gnu.org> | 2010-07-11 09:55:11 +0200 |
---|---|---|
committer | Janus Weil <janus@gcc.gnu.org> | 2010-07-11 09:55:11 +0200 |
commit | d40477b49fd716b39484746200db3ae99fef7230 (patch) | |
tree | 16cd0f7ef9f241752f876619444e0b2b144f087f /gcc/fortran/decl.c | |
parent | 76986b412bae95c36f54fa5c13cf46a54dca2e30 (diff) | |
download | gcc-d40477b49fd716b39484746200db3ae99fef7230.zip gcc-d40477b49fd716b39484746200db3ae99fef7230.tar.gz gcc-d40477b49fd716b39484746200db3ae99fef7230.tar.bz2 |
re PR fortran/44869 ([OOP] generic TBPs not initialized properly)
2010-07-11 Janus Weil <janus@gcc.gnu.org>
PR fortran/44689
* decl.c (build_sym,attr_decl1): Only build the class container if the
symbol has sufficient attributes.
* expr.c (gfc_check_pointer_assign): Use class_pointer instead of
pointer attribute for classes.
* match.c (gfc_match_allocate,gfc_match_deallocate): Ditto.
* module.c (MOD_VERSION): Bump.
(enum ab_attribute,attr_bits): Add AB_CLASS_POINTER.
(mio_symbol_attribute): Handle class_pointer attribute.
* parse.c (parse_derived): Use class_pointer instead of pointer
attribute for classes.
* primary.c (gfc_variable_attr,gfc_expr_attr): Ditto.
* resolve.c (resolve_structure_cons,resolve_deallocate_expr,
resolve_allocate_expr,resolve_fl_derived): Ditto.
(resolve_fl_var_and_proc): Check for class_ok attribute.
2010-07-11 Janus Weil <janus@gcc.gnu.org>
PR fortran/44689
* gfortran.dg/class_24.f03: New.
From-SVN: r162052
Diffstat (limited to 'gcc/fortran/decl.c')
-rw-r--r-- | gcc/fortran/decl.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index e5ef139..9515676 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -1155,13 +1155,10 @@ build_sym (const char *name, gfc_charlen *cl, sym->attr.implied_index = 0; - if (sym->ts.type == BT_CLASS) - { - sym->attr.class_ok = (sym->attr.dummy - || sym->attr.pointer - || sym->attr.allocatable) ? 1 : 0; - gfc_build_class_symbol (&sym->ts, &sym->attr, &sym->as, false); - } + if (sym->ts.type == BT_CLASS + && (sym->attr.class_ok = sym->attr.dummy || sym->attr.pointer + || sym->attr.allocatable)) + gfc_build_class_symbol (&sym->ts, &sym->attr, &sym->as, false); return SUCCESS; } @@ -5874,7 +5871,7 @@ attr_decl1 (void) /* Update symbol table. DIMENSION attribute is set in gfc_set_array_spec(). For CLASS variables, this must be applied to the first component, or '$data' field. */ - if (sym->ts.type == BT_CLASS) + if (sym->ts.type == BT_CLASS && sym->ts.u.derived->attr.is_class) { if (gfc_copy_attr (&CLASS_DATA (sym)->attr, ¤t_attr,&var_locus) == FAILURE) @@ -5882,8 +5879,6 @@ attr_decl1 (void) m = MATCH_ERROR; goto cleanup; } - sym->attr.class_ok = (sym->attr.class_ok || current_attr.allocatable - || current_attr.pointer); } else { @@ -5894,6 +5889,11 @@ attr_decl1 (void) goto cleanup; } } + + if (sym->ts.type == BT_CLASS && !sym->attr.class_ok + && (sym->attr.class_ok = sym->attr.class_ok || current_attr.allocatable + || current_attr.pointer)) + gfc_build_class_symbol (&sym->ts, &sym->attr, &sym->as, false); if (gfc_set_array_spec (sym, as, &var_locus) == FAILURE) { |