This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [fortran, 4.5] Implement errmsg for [de]allocate
- From: Tobias Burnus <burnus at net-b dot de>
- To: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- Cc: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Wed, 03 Dec 2008 20:28:48 +0100
- Subject: Re: [fortran, 4.5] Implement errmsg for [de]allocate
- References: <20081203190601.GA10232@troutmask.apl.washington.edu>
Hi Steve,
Steve Kargl wrote:
> The attached patch implements the F2003 feature of ERRMSG= in
> the [DE]ALLOCATE statements. The current patch makes use of
> the infrastructure for STAT= to determine if a failure occurs.
>
Somehow it does not work if one additionally requests a STAT= variable:
deallocate(x, stat=i, errmsg=err)
1
Error: Syntax error in DEALLOCATE statement at (1)
(Ditto for: errmsg=..., stat=...)
Additionally: Can we add a -Wsurprising which checks for the presence of
STAT= when ERRMSG= is given? NAG f95 prints:
Warning: hfjgf.f90, line 6: ERRMSG= is useless without STAT=
> deallocate(x, x, errmsg=err)
> print *, err
There are several issues:
a) "deallocate(x, x)" is invalid, which can be compile-time diagnosable
(as e.g. ifort does), better place it in two lines
b) "print *, err" is invalid - it always prints uninitialized value (in
case of success). In case of a failure, it does not print anything as
DEALLOCATE aborts
"If an error condition occurs during execution of an ALLOCATE statement
that does not contain the STAT= specifier, execution of the program is
terminated."
I will review the patch itself later.
Tobias