Commit bc0f8bd4 by Mikael Morin Committed by Mikael Morin

re PR fortran/36463 (gfc_get_default_type(): Bad symbol)

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.

From-SVN: r142191
parent 056c1652
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
......
......@@ -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;
}
......
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
......
! { 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" } }
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