This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Implement sizeof intrinsic, a minor cleanups to trans-intrinsic.c
- From: Tobias Schlüter <tobias dot schlueter at physik dot uni-muenchen dot de>
- To: Tobias Schlüter <tobias dot schlueter at physik dot uni-muenchen dot de>
- Cc: Fortran List <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 28 May 2007 20:55:06 +0200
- Subject: Re: [patch] Implement sizeof intrinsic, a minor cleanups to trans-intrinsic.c
- References: <465B1065.4070501@physik.uni-muenchen.de>
Tobias Schlüter wrote:
the attached patch implements the SIZEOF intrinsic. Since the code for
determining the length is copied from the code for TRANSFER, I had a
chance to look at that as well and noticed the complete lack of
constant-folding in it as well as a redundant initialization, which I
chose to fix. The code could also be somewhat simplified, as I did in
the version for SIZEOF, but for fear of introducing bugs, I didn't touch
it. I tried to avoid the redundancy between the two size-determination
codes by merging them, but failed at doing so: I would have had to walk
the expression twice in gfc_conv_intrinsic_array_transfer, which
wouldn't have left me with much saved code.
I had this cooking for so long, that I forgot to mention that I didn't
use the new frontend-stuff for sizing expressions because that only
works for initialization expressions, not for general expressions (maybe
this should be asserted in the code). I should have also pointed out
that this patch implements sizeof for all expressions as its argument,
which seems to be what ifc does, even though its documentation sounds as
if it only worked if the size could be determined at compile-time.
- Tobi