diff options
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r-- | gcc/fortran/resolve.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 3d8fd3c..0d39b2d 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -834,6 +834,16 @@ resolve_structure_cons (gfc_expr *expr) t = gfc_convert_type (cons->expr, &comp->ts, 1); } + if (cons->expr->expr_type == EXPR_NULL + && !(comp->pointer || comp->allocatable)) + { + t = FAILURE; + gfc_error ("The NULL in the derived type constructor at %L is " + "being applied to component '%s', which is neither " + "a POINTER nor ALLOCATABLE", &cons->expr->where, + comp->name); + } + if (!comp->pointer || cons->expr->expr_type == EXPR_NULL) continue; @@ -7973,6 +7983,29 @@ resolve_symbol (gfc_symbol *sym) return; } + /* Make sure that the derived type has been resolved and that the + derived type is visible in the symbol's namespace, if it is a + module function and is not PRIVATE. */ + if (sym->ts.type == BT_DERIVED + && sym->ts.derived->attr.use_assoc + && sym->ns->proc_name->attr.flavor == FL_MODULE) + { + gfc_symbol *ds; + + if (resolve_fl_derived (sym->ts.derived) == FAILURE) + return; + + gfc_find_symbol (sym->ts.derived->name, sym->ns, 1, &ds); + if (!ds && sym->attr.function + && gfc_check_access (sym->attr.access, sym->ns->default_access)) + { + symtree = gfc_new_symtree (&sym->ns->sym_root, + sym->ts.derived->name); + symtree->n.sym = sym->ts.derived; + sym->ts.derived->refs++; + } + } + /* Unless the derived-type declaration is use associated, Fortran 95 does not allow public entries of private derived types. See 4.4.1 (F95) and 4.5.1.1 (F2003); and related interpretation |