mirror of git://gcc.gnu.org/git/gcc.git
re PR fortran/51948 ([OOP] Rejects valid: Function result value in MOVE_ALLOC, nested in SELECT TYPE)
2012-01-23 Tobias Burnus <burnus@net-b.de>
PR fortran/51948
* check.c (variable_check): Fix checking for
result variables and deeply nested BLOCKs.
2012-01-23 Tobias Burnus <burnus@net-b.de>
PR fortran/51948
* gfortran.dg/move_alloc_12.f90: New.
From-SVN: r183453
This commit is contained in:
parent
8ae4c24b4c
commit
048037281c
|
|
@ -1,3 +1,9 @@
|
||||||
|
2012-01-23 Tobias Burnus <burnus@net-b.de>
|
||||||
|
|
||||||
|
PR fortran/51948
|
||||||
|
* check.c (variable_check): Fix checking for
|
||||||
|
variables and deeply nested BLOCKs.
|
||||||
|
|
||||||
2012-01-21 Tobias Burnus <burnus@net-b.de>
|
2012-01-21 Tobias Burnus <burnus@net-b.de>
|
||||||
Steven G. Kargl <kargl@gcc.gnu.org>
|
Steven G. Kargl <kargl@gcc.gnu.org>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -521,15 +521,18 @@ variable_check (gfc_expr *e, int n, bool allow_proc)
|
||||||
|
|
||||||
if (e->expr_type == EXPR_VARIABLE
|
if (e->expr_type == EXPR_VARIABLE
|
||||||
&& e->symtree->n.sym->attr.flavor != FL_PARAMETER
|
&& e->symtree->n.sym->attr.flavor != FL_PARAMETER
|
||||||
&& (allow_proc
|
&& (allow_proc || !e->symtree->n.sym->attr.function))
|
||||||
|| !e->symtree->n.sym->attr.function
|
|
||||||
|| (e->symtree->n.sym == e->symtree->n.sym->result
|
|
||||||
&& (e->symtree->n.sym == gfc_current_ns->proc_name
|
|
||||||
|| (gfc_current_ns->parent
|
|
||||||
&& e->symtree->n.sym
|
|
||||||
== gfc_current_ns->parent->proc_name)))))
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
|
|
||||||
|
if (e->expr_type == EXPR_VARIABLE && e->symtree->n.sym->attr.function
|
||||||
|
&& e->symtree->n.sym == e->symtree->n.sym->result)
|
||||||
|
{
|
||||||
|
gfc_namespace *ns;
|
||||||
|
for (ns = gfc_current_ns; ns; ns = ns->parent)
|
||||||
|
if (ns->proc_name == e->symtree->n.sym)
|
||||||
|
return SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
gfc_error ("'%s' argument of '%s' intrinsic at %L must be a variable",
|
gfc_error ("'%s' argument of '%s' intrinsic at %L must be a variable",
|
||||||
gfc_current_intrinsic_arg[n]->name, gfc_current_intrinsic, &e->where);
|
gfc_current_intrinsic_arg[n]->name, gfc_current_intrinsic, &e->where);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,8 @@
|
||||||
|
2012-01-23 Tobias Burnus <burnus@net-b.de>
|
||||||
|
|
||||||
|
PR fortran/51948
|
||||||
|
* gfortran.dg/move_alloc_12.f90: New.
|
||||||
|
|
||||||
2012-01-23 Ramana Radhakrishnan <ramana.radhakrishnan@linaro.org>
|
2012-01-23 Ramana Radhakrishnan <ramana.radhakrishnan@linaro.org>
|
||||||
|
|
||||||
PR middle-end/45416
|
PR middle-end/45416
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
! { dg-do compile }
|
||||||
|
!
|
||||||
|
! PR fortran/51948
|
||||||
|
!
|
||||||
|
type :: t
|
||||||
|
end type t
|
||||||
|
contains
|
||||||
|
function func(x, y)
|
||||||
|
class(t) :: y
|
||||||
|
type(t), allocatable :: func
|
||||||
|
type(t), allocatable :: x
|
||||||
|
|
||||||
|
select type (y)
|
||||||
|
type is(t)
|
||||||
|
call move_alloc (x, func)
|
||||||
|
end select
|
||||||
|
end function
|
||||||
|
|
||||||
|
function func2(x, y)
|
||||||
|
class(t) :: y
|
||||||
|
class(t), allocatable :: func2
|
||||||
|
class(t), allocatable :: x
|
||||||
|
|
||||||
|
block
|
||||||
|
block
|
||||||
|
select type (y)
|
||||||
|
type is(t)
|
||||||
|
call move_alloc (x, func2)
|
||||||
|
end select
|
||||||
|
end block
|
||||||
|
end block
|
||||||
|
end function
|
||||||
|
end
|
||||||
Loading…
Reference in New Issue