diff options
author | Daniel Franke <franke.daniel@gmail.com> | 2008-03-28 18:57:25 -0400 |
---|---|---|
committer | Daniel Franke <dfranke@gcc.gnu.org> | 2008-03-28 18:57:25 -0400 |
commit | 01d2a7d70396ca672c10a4ed68d1739b42dbc1ae (patch) | |
tree | c75023c35ce4493e5451b72fe5cb99c3b2cce45e /gcc/fortran | |
parent | 716aaa593ae2583e36d545fef90c939630152d67 (diff) | |
download | gcc-01d2a7d70396ca672c10a4ed68d1739b42dbc1ae.zip gcc-01d2a7d70396ca672c10a4ed68d1739b42dbc1ae.tar.gz gcc-01d2a7d70396ca672c10a4ed68d1739b42dbc1ae.tar.bz2 |
re PR fortran/34714 (ICE-on-invalid in gfc_conv_descriptor_dtype)
gcc/fortran:
2008-03-28 Daniel Franke <franke.daniel@gmail.com>
Paul Richard Thomas <paul.richard.thomas@gmail.com>
PR fortran/34714
* primary.c (match_variable): Improved matching of function
result variables.
* resolve.c (resolve_allocate_deallocate): Removed checks if
the actual argument for STAT is a variable.
gcc/testsuite:
2008-03-28 Daniel Franke <franke.daniel@gmail.com>
PR fortran/34714
* gfortran.dg/alloc_alloc_expr_3.f90: New test.
* gfortran.dg/allocate_stat.f90: Adjusted error-match text.
* gfortran.dg/func_assign.f90: Likewise.
* gfortran.dg/implicit_11.f90: Likewise.
* gfortran.dg/proc_assign_1.f90: Likewise.
* gfortran.dg/proc_assign_2.f90: Likewise.
* gfortran.dg/procedure_lvalue.f90: Likewise.
Co-Authored-By: Paul Richard Thomas <paul.richard.thomas@gmail.com>
From-SVN: r133701
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/fortran/primary.c | 14 | ||||
-rw-r--r-- | gcc/fortran/resolve.c | 40 |
3 files changed, 21 insertions, 42 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 5731e20..0658995 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,12 @@ +2008-03-28 Daniel Franke <franke.daniel@gmail.com> + Paul Richard Thomas <paul.richard.thomas@gmail.com> + + PR fortran/34714 + * primary.c (match_variable): Improved matching of function + result variables. + * resolve.c (resolve_allocate_deallocate): Removed checks if + the actual argument for STAT is a variable. + 2008-03-28 Tobias Burnus <burnus@net-b.de> * symbol.c (gfc_get_default_type): Fix error message; option diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c index f6b1635..8f85873 100644 --- a/gcc/fortran/primary.c +++ b/gcc/fortran/primary.c @@ -2561,8 +2561,18 @@ match_variable (gfc_expr **result, int equiv_flag, int host_flag) break; case FL_PROCEDURE: - /* Check for a nonrecursive function result */ - if (sym->attr.function && sym->result == sym && !sym->attr.external) + /* Check for a nonrecursive function result variable. */ + if (sym->attr.function + && !sym->attr.external + && sym->result == sym + && ((sym == gfc_current_ns->proc_name + && sym == gfc_current_ns->proc_name->result) + || (gfc_current_ns->parent + && sym == gfc_current_ns->parent->proc_name->result) + || (sym->attr.entry + && sym->ns == gfc_current_ns) + || (sym->attr.entry + && sym->ns == gfc_current_ns->parent))) { /* If a function result is a derived type, then the derived type may still have to be resolved. */ diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 0d39b2d..41b1add 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -4878,7 +4878,6 @@ resolve_allocate_deallocate (gfc_code *code, const char *fcn) { gfc_symbol *s = NULL; gfc_alloc *a; - bool is_variable; if (code->expr) s = code->expr->symtree->n.sym; @@ -4892,45 +4891,6 @@ resolve_allocate_deallocate (gfc_code *code, const char *fcn) if (gfc_pure (NULL) && gfc_impure_variable (s)) gfc_error ("Illegal STAT variable in %s statement at %C " "for a PURE procedure", fcn); - - is_variable = false; - if (s->attr.flavor == FL_VARIABLE) - is_variable = true; - else if (s->attr.function && s->result == s - && (gfc_current_ns->proc_name == s - || - (gfc_current_ns->parent - && gfc_current_ns->parent->proc_name == s))) - is_variable = true; - else if (gfc_current_ns->entries && s->result == s) - { - gfc_entry_list *el; - for (el = gfc_current_ns->entries; el; el = el->next) - if (el->sym == s) - { - is_variable = true; - } - } - else if (gfc_current_ns->parent && gfc_current_ns->parent->entries - && s->result == s) - { - gfc_entry_list *el; - for (el = gfc_current_ns->parent->entries; el; el = el->next) - if (el->sym == s) - { - is_variable = true; - } - } - - if (s->attr.flavor == FL_UNKNOWN - && gfc_add_flavor (&s->attr, FL_VARIABLE, - s->name, NULL) == SUCCESS) - is_variable = true; - - if (!is_variable) - gfc_error ("STAT tag in %s statement at %L must be " - "a variable", fcn, &code->expr->where); - } if (s && code->expr->ts.type != BT_INTEGER) |