re PR fortran/50659 ([F03] ICE with PROCEDURE statement)
2011-10-15 Janus Weil <janus@gcc.gnu.org> PR fortran/50659 * expr.c (replace_symbol): Only do replacement if the symbol is a dummy. 2011-10-15 Janus Weil <janus@gcc.gnu.org> PR fortran/50659 * gfortran.dg/proc_decl_27.f90: New. From-SVN: r180032
This commit is contained in:
parent
ae8dbbca06
commit
b848f23f90
|
@ -1,3 +1,8 @@
|
|||
2011-10-15 Janus Weil <janus@gcc.gnu.org>
|
||||
|
||||
PR fortran/50659
|
||||
* expr.c (replace_symbol): Only do replacement if the symbol is a dummy.
|
||||
|
||||
2011-09-01 Mikael Morin <mikael.morin@sfr.fr>
|
||||
|
||||
PR fortran/50050
|
||||
|
|
|
@ -3609,8 +3609,9 @@ gfc_expr_check_typed (gfc_expr* e, gfc_namespace* ns, bool strict)
|
|||
return error_found ? FAILURE : SUCCESS;
|
||||
}
|
||||
|
||||
/* Walk an expression tree and replace all symbols with a corresponding symbol
|
||||
in the formal_ns of "sym". Needed for copying interfaces in PROCEDURE
|
||||
|
||||
/* Walk an expression tree and replace all dummy symbols by the corresponding
|
||||
symbol in the formal_ns of "sym". Needed for copying interfaces in PROCEDURE
|
||||
statements. The boolean return value is required by gfc_traverse_expr. */
|
||||
|
||||
static bool
|
||||
|
@ -3619,14 +3620,12 @@ replace_symbol (gfc_expr *expr, gfc_symbol *sym, int *i ATTRIBUTE_UNUSED)
|
|||
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)
|
||||
&& expr->symtree->n.sym->ns == sym->ts.interface->formal_ns
|
||||
&& expr->symtree->n.sym->attr.dummy)
|
||||
{
|
||||
gfc_symtree *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);
|
||||
gfc_symtree *root = sym->formal_ns ? sym->formal_ns->sym_root
|
||||
: gfc_current_ns->sym_root;
|
||||
gfc_symtree *stree = gfc_find_symtree (root, expr->symtree->n.sym->name);
|
||||
gcc_assert (stree);
|
||||
stree->n.sym->attr = expr->symtree->n.sym->attr;
|
||||
expr->symtree = stree;
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2011-10-15 Janus Weil <janus@gcc.gnu.org>
|
||||
|
||||
PR fortran/50659
|
||||
* gfortran.dg/proc_decl_27.f90: New.
|
||||
|
||||
2011-10-13 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/50618
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
! { dg-do compile }
|
||||
!
|
||||
! PR 50659: [4.5/4.6/4.7 Regression] [F03] ICE on invalid with procedure interface
|
||||
!
|
||||
! Contributed by Andrew Benson <abenson@caltech.edu>
|
||||
|
||||
module m1
|
||||
integer :: arrSize
|
||||
end module
|
||||
|
||||
module m2
|
||||
contains
|
||||
function Proc (arg)
|
||||
use m1
|
||||
double precision, dimension(arrSize) :: proc
|
||||
double precision :: arg
|
||||
end function
|
||||
end
|
||||
|
||||
use m2
|
||||
implicit none
|
||||
procedure(Proc) :: Proc_Get
|
||||
end
|
||||
|
||||
! { dg-final { cleanup-modules "m1 m2" } }
|
Loading…
Reference in New Issue