summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/allocatable_scalar_11.f90
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/allocatable_scalar_11.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/allocatable_scalar_11.f9028
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/allocatable_scalar_11.f90 b/gcc/testsuite/gfortran.dg/allocatable_scalar_11.f90
new file mode 100644
index 000000000..b9fb10857
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/allocatable_scalar_11.f90
@@ -0,0 +1,28 @@
+! { dg-do compile }
+!
+! PR fortran/46484
+!
+
+function g()
+ implicit none
+ integer, allocatable :: g
+ call int()
+ print *, loc(g) ! OK
+contains
+ subroutine int()
+ print *, loc(g) ! OK
+ print *, allocated(g) ! OK
+ end subroutine int
+end function
+
+implicit none
+integer, allocatable :: x
+print *, allocated(f) ! { dg-error "must be a variable" }
+print *, loc(f) ! OK
+contains
+function f()
+ integer, allocatable :: f
+ print *, loc(f) ! OK
+ print *, allocated(f) ! OK
+end function
+end