diff options
author | mikael <mikael@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-11-25 13:27:26 +0000 |
---|---|---|
committer | mikael <mikael@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-11-25 13:27:26 +0000 |
commit | ea04e3dd6de054c0a21aef31c38081092b22ad7f (patch) | |
tree | 4731d54804dc0b9fe0fc75c8c985166a91c4f7b8 | |
parent | 8c50625d916841a80c1143900dbbd0cb6c6395bb (diff) | |
download | gcc-ea04e3dd6de054c0a21aef31c38081092b22ad7f.tar.gz |
2008-11-25 Mikael Morin <mikael.morin@tele2.fr>
PR fortran/36463
* expr.c (replace_symbol): Don't replace the symtree
if the expresion is an intrinsic function. Don't create
non-existent symtrees. Use symbol's name instead of symtree's,
different in case of module procedure dummy arguments.
2008-11-25 Mikael Morin <mikael.morin@tele2.fr>
PR fortran/36463
* gfortran.dg/proc_decl_20.f90: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@142191 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/fortran/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/fortran/expr.c | 11 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/proc_decl_20.f90 | 24 |
4 files changed, 46 insertions, 2 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index a75f983f1bd..b22c8da5eae 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,11 @@ +2008-11-25 Mikael Morin <mikael.morin@tele2.fr> + + PR fortran/36463 + * expr.c (replace_symbol): Don't replace the symtree + if the expresion is an intrinsic function. Don't create + non-existent symtrees. Use symbol's name instead of symtree's, + different in case of module procedure dummy arguments. + 2008-11-25 Jan Kratochvil <jan.kratochvil@redhat.com> PR fortran/38248 diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index ea766537a50..4017cf91f33 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -3510,11 +3510,18 @@ gfc_expr_check_typed (gfc_expr* e, gfc_namespace* ns, bool strict) static bool replace_symbol (gfc_expr *expr, gfc_symbol *sym, int *i ATTRIBUTE_UNUSED) { - if ((expr->expr_type == EXPR_VARIABLE || expr->expr_type == EXPR_FUNCTION) + if ((expr->expr_type == EXPR_VARIABLE + || (expr->expr_type == EXPR_FUNCTION + && !gfc_is_intrinsic (expr->symtree->n.sym, 0, expr->where))) && expr->symtree->n.sym->ns == sym->ts.interface->formal_ns) { gfc_symtree *stree; - gfc_get_sym_tree (expr->symtree->name, sym->formal_ns, &stree); + gfc_namespace *ns = sym->formal_ns; + /* Don't use gfc_get_symtree as we prefer to fail badly if we don't find + the symtree rather than create a new one (and probably fail later). */ + stree = gfc_find_symtree (ns ? ns->sym_root : gfc_current_ns->sym_root, + expr->symtree->n.sym->name); + gcc_assert (stree); stree->n.sym->attr = expr->symtree->n.sym->attr; expr->symtree = stree; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 860fa8c4e99..d3c09d1ecaa 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-11-25 Mikael Morin <mikael.morin@tele2.fr> + + PR fortran/36463 + * gfortran.dg/proc_decl_20.f90: New test. + 2008-11-25 Richard Guenther <rguenther@suse.de> PR middle-end/38151 diff --git a/gcc/testsuite/gfortran.dg/proc_decl_20.f90 b/gcc/testsuite/gfortran.dg/proc_decl_20.f90 new file mode 100644 index 00000000000..612dac19529 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/proc_decl_20.f90 @@ -0,0 +1,24 @@ +! { dg-do compile } +! +! PR fortran/36463 +! Gfortran used to fail on this testcase with: +! gfc_get_default_type(): Bad symbol '@0' +! +! Original program by James Van Buskirk +! Reduced by Janus Weil <janus@gcc.gnu.org> + +module other_fun + interface + function abstract_fun(x) + integer x + integer abstract_fun(x) + end function abstract_fun + end interface +end module other_fun + + program fptr + use other_fun + procedure(abstract_fun) :: fun + end program fptr + +! { dg-final { cleanup-modules "other_fun" } } |