[Patch, Fortran] PR fortran/37507: Some clean-up of (DE)ALLOCATE errors
Daniel Kraft
d@domob.eu
Sun Sep 14 18:09:00 GMT 2008
Hi,
this patch addresses PR fortran/37507 by adding a locus and variable
name to the runtime errors displayed when allocating an already
allocated "allocatable" array or when attempting to deallocate a not
allocated array/pointer.
I split off the logic to generate the error message from
gfc_trans_runtime_check into a new method (or two new methods)
gfc_trans_runtime_error(_vararg) that generates code to display a
runtime error/warning optionally with locus information and printf-like
message formatting.
In addition, I changed the (de)allocation trans'ing where necessary to
pass down the original gfc_expr so that I have access to its locus and
variable name in gfc_deallocate_with_status and gfc_allocate_array and
use the new runtime error routine there for message generation instead
of the on-the-fly code generation that was used there instead. IMHO,
this not only improves the usefulness of the error message but also
cleans up and simplifies the code a bit.
As with my last patches, on the way of analyzing/experimenting some
formatting-corrections slipped in as well; I hope those are ok,
otherwise I can revert them.
No regressions on GNU/Linux-x86-32. Ok for trunk?
Cheers,
Daniel
PS: I did a context diff but the patch still looks quite
incomprehensible in places... Sorry, I hope it is not too bad.
--
Done: Arc-Bar-Cav-Sam-Val-Wiz, Dwa-Elf-Gno-Hum-Orc, Law-Neu-Cha, Fem-Mal
To go: Hea-Kni-Mon-Pri-Ran-Rog-Tou
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch.changelog
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20080914/70173506/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch.diff
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20080914/70173506/attachment-0001.ksh>
More information about the Fortran
mailing list