This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch, fortran] PR32124 - Don't give a run-time error if stat= has been specified for ALLOCATE
- From: Tobias Burnus <burnus at net-b dot de>
- To: Thomas Koenig <tkoenig at alice-dsl dot net>, gcc-patches <gcc-patches at gcc dot gnu dot org>, "'fortran at gcc dot gnu dot org'" <fortran at gcc dot gnu dot org>
- Date: Mon, 28 May 2007 20:10:57 +0200
- Subject: Re: [patch, fortran] PR32124 - Don't give a run-time error if stat= has been specified for ALLOCATE
- References: <465AD50A.6000206@net-b.de> <1180373706.3532.3.camel@meiner.onlinehome.de>
Hi,
Thomas Koenig wrote:
> FX already beat me to OKing this patch, but I still think it would be
> nice if you added a test case :-)
>
I don't know whether the allocation fails on all platforms but it fail
one mine.
Ok for the trunk?
Tobias
2007-05-28 Tobias Burnus <burnus@net-b.de>
PR fortran/32124
* gfortran.dg/allocate_stat_1.f90: New.
Index: gcc/testsuite/gfortran.dg/allocate_stat_1.f90
===================================================================
--- gcc/testsuite/gfortran.dg/allocate_stat_1.f90 (Revision 0)
+++ gcc/testsuite/gfortran.dg/allocate_stat_1.f90 (Revision 0)
@@ -0,0 +1,17 @@
+! { dg-do run }
+! Check whether uppon failure no run-time error is issued.
+! PR fortran/32124
+!
+program mem
+ implicit none
+ real(8), allocatable :: A(:,:,:,:)
+ integer :: status
+
+ status = 0
+ allocate(A(huge(0),huge(0),huge(0),huge(0)),stat=status) ! this should fail
+ if(status == 0) call abort()
+
+ status = 0
+ deallocate(A,stat=status)
+ if(status == 0) call abort()
+end program mem