This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, Fortran] Enable the generation of the FINALization wrapper function
- From: Tobias Burnus <burnus at net-b dot de>
- To: Janus Weil <janus at gcc dot gnu dot org>
- Cc: gcc patches <gcc-patches at gcc dot gnu dot org>, gfortran <fortran at gcc dot gnu dot org>
- Date: Wed, 29 May 2013 15:22:32 +0200
- Subject: Re: [Patch, Fortran] Enable the generation of the FINALization wrapper function
- References: <519D164E dot 100 at net-b dot de> <51A38128 dot 1070509 at net-b dot de> <CAKwh3qg09745xpeT03AEty4JJoj4mfg=LTU38_rkrxnzSK1T0A at mail dot gmail dot com>
Janus Weil wrote:
Build and regtested on x86-64-gnu-linux.
OK for the trunk?
I think this patch is ok. Just one nit:
@@ -5571,7 +5569,7 @@ gfc_dump_module (const char *name, int dump_flag)
FIXME: For backwards compatibility with the old uncompressed
module format, write an extra empty line. When the module version
is bumped, this can be removed. */
- gzprintf (module_fp, "GFORTRAN module version '%s' created from %s\n\n",
+ gzprintf (module_fp, "GFORTRAN module version '%s' created from %s\n",
MOD_VERSION, gfc_source_file);
Here you should remove the FIXME.
I thought I had done this - but seemingly I missed that one. DONE.
Dominique was that brave and tested the posted patches. Doing so, he
found that the finalization wrapper causes an ICE with -m32. The reason
is that I use gfc_convert_type to convert the kind value of result
variable of the RANK intrinsic.
It turned out that calling that for a no op conversion leads to an ICE
(internal error). (The conversion is supposed to convert the
default-kind result value to the gfc_array_index_kind, otherwise one
runs into an ICE at tree level.) Well, the solution is simple: Only
convert it when needed. Hence, I included the following patch in the
committal (Rev. 199409).
--- a/gcc/fortran/class.c
+++ b/gcc/fortran/class.c
@@ -1644 +1644,2 @@ generate_finalization_wrapper (gfc_symbol *derived,
gfc_namespace *ns,
- gfc_convert_type (rank, &idx->ts, 2);
+ if (rank->ts.kind != idx->ts.kind)
+ gfc_convert_type_warn (rank, &idx->ts, 2, 0);
Thanks to both of you for the review and the testing.
* * *
Now the important ingredients for finalization are all in, the next task
is to actually do finalization. The first patch has been posted, but it
will take a while until all finalization calls will be available.
Tobias