2010-11-15 Tobias Burnus <burnus@net.b.de>
PR fortran/46484
* check.c (variable_check): Don't treat functions as variables.
2010-11-15 Tobias Burnus <burnus@net.b.de>
PR fortran/46484
* gfortran.dg/allocatable_scalar_11.f90: New.
gfortran.dg/allocatable_scalar_5.f90: Make test case standard conform.
@@ -491,10 +491,8 @@ variable_check (gfc_expr *e, int n)
return FAILURE;
}
- if ((e->expr_type == EXPR_VARIABLE
+ if (e->expr_type == EXPR_VARIABLE
&& e->symtree->n.sym->attr.flavor != FL_PARAMETER)
- || (e->expr_type == EXPR_FUNCTION
- && e->symtree->n.sym->result == e->symtree->n.sym))
return SUCCESS;
gfc_error ("'%s' argument of '%s' intrinsic at %L must be a variable",
new file mode 100644
@@ -0,0 +1,13 @@
+! { dg-compile }
+!
+! PR fortran/46484
+!
+
+implicit none
+logical :: ll
+ll = allocated (f()) ! { dg-error "must be a variable" }
+contains
+ function f()
+ integer, allocatable :: f
+ end function f
+end
@@ -1,7 +1,7 @@
! { dg-do run }
! { dg-options "-Wall -pedantic" }
!
-! PR fortran/41872
+! PR fortran/41872; updated due to PR fortran/46484
!
! More tests for allocatable scalars
!
@@ -11,8 +11,6 @@ program test
integer :: b
if (allocated (a)) call abort ()
- if (allocated (func (.false.))) call abort ()
- if (.not.allocated (func (.true.))) call abort ()
b = 7
b = func(.true.)
if (b /= 5332) call abort ()
@@ -28,7 +26,6 @@ program test
call intout2 (a)
if (allocated (a)) call abort ()
- if (allocated (func2 ())) call abort ()
contains
function func (alloc)
@@ -41,10 +38,6 @@ contains
end if
end function func
- function func2 ()
- integer, allocatable :: func2
- end function func2
-
subroutine intout (dum, alloc)
implicit none
integer, allocatable,intent(out) :: dum