aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/allocate_stat.f90
diff options
context:
space:
mode:
authorBen Cheng <bccheng@google.com>2014-03-25 22:37:19 -0700
committerBen Cheng <bccheng@google.com>2014-03-25 22:37:19 -0700
commit1bc5aee63eb72b341f506ad058502cd0361f0d10 (patch)
treec607e8252f3405424ff15bc2d00aa38dadbb2518 /gcc-4.9/gcc/testsuite/gfortran.dg/allocate_stat.f90
parent283a0bf58fcf333c58a2a92c3ebbc41fb9eb1fdb (diff)
downloadtoolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.gz
toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.bz2
toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.zip
Initial checkin of GCC 4.9.0 from trunk (r208799).
Change-Id: I48a3c08bb98542aa215912a75f03c0890e497dba
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gfortran.dg/allocate_stat.f90')
-rw-r--r--gcc-4.9/gcc/testsuite/gfortran.dg/allocate_stat.f9076
1 files changed, 76 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gfortran.dg/allocate_stat.f90 b/gcc-4.9/gcc/testsuite/gfortran.dg/allocate_stat.f90
new file mode 100644
index 000000000..7f9eaf58d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gfortran.dg/allocate_stat.f90
@@ -0,0 +1,76 @@
+! { dg-do compile }
+! PR fortran/32936
+!
+!
+function all_res()
+ implicit none
+ real, pointer :: gain
+ integer :: all_res
+ allocate (gain,STAT=all_res)
+ deallocate(gain)
+ call bar()
+contains
+ subroutine bar()
+ real, pointer :: gain2
+ allocate (gain2,STAT=all_res)
+ deallocate(gain2)
+ end subroutine bar
+end function all_res
+
+function func()
+ implicit none
+ real, pointer :: gain
+ integer :: all_res2, func
+ func = 0
+entry all_res2
+ allocate (gain,STAT=all_res2)
+ deallocate(gain)
+contains
+ subroutine test
+ implicit none
+ real, pointer :: gain2
+ allocate (gain2,STAT=all_res2)
+ deallocate(gain2)
+ end subroutine test
+end function func
+
+function func2() result(res)
+ implicit none
+ real, pointer :: gain
+ integer :: res
+ allocate (gain,STAT=func2) ! { dg-error "is not a variable" }
+ deallocate(gain)
+ res = 0
+end function func2
+
+subroutine sub()
+ implicit none
+ interface
+ integer function func2()
+ end function
+ end interface
+ real, pointer :: gain
+ integer, parameter :: res = 2
+ allocate (gain,STAT=func2) ! { dg-error "is not a variable" }
+ deallocate(gain)
+end subroutine sub
+
+module test
+contains
+ function one()
+ integer :: one, two
+ integer, pointer :: ptr
+ allocate(ptr, stat=one)
+ if(one == 0) deallocate(ptr)
+ entry two
+ allocate(ptr, stat=two)
+ if(associated(ptr)) deallocate(ptr)
+ end function one
+ subroutine sub()
+ integer, pointer :: p
+ allocate(p, stat=one) ! { dg-error "is not a variable" }
+ if(associated(p)) deallocate(p)
+ allocate(p, stat=two) ! { dg-error "is not a variable" }
+ if(associated(p)) deallocate(p)
+ end subroutine sub
+end module test