[patch] Implement sizeof intrinsic, a minor cleanups to trans-intrinsic.c

Tobias Schlüter tobias.schlueter@physik.uni-muenchen.de
Mon May 28 19:19:00 GMT 2007


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



More information about the Gcc-patches mailing list