[Patch, Fortran] Some simplification for ?BOUND/SHAPE/SIZE and non-variable expressions

Daniel Kraft d@domob.eu
Wed Jul 28 13:26:00 GMT 2010


Hi all,

for array expressions like "a + b" or ".NOT. c" (and basically all with 
expr_type != EXPR_VARIABLE), the LBOUND is 1 and UBOUND is given by the 
shape.  The shape of expressions involving an operator is in turn given 
by one of the operands.

This patch adds simplification logic for LBOUND/UBOUND/SHAPE/SIZE that 
handles a lot of these cases.  Previously, for something like

LBOUND(a+b, DIM=1)

a temporary array (for a+b) was constructed with is clearly very 
inefficient.  This is now avoided.

Granted, it is probably not very common to use those intrinsics with 
array-expressions, but it will help (at least for some part) with 
ASSOCIATE targetting such array-expressions (which is currently not yet 
implemented).

The patch also fixes a memory-leak in simplify_bound where the result 
expression was not free'ed in certain situations.

Regression-testing at the moment on GNU/Linux-x86-32.  Ok for trunk if 
no failures?

Daniel

-- 
http://www.pro-vegan.info/
--
Done:  Arc-Bar-Cav-Ran-Rog-Sam-Tou-Val-Wiz
To go: Hea-Kni-Mon-Pri


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch.changelog
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20100728/969789ef/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch.diff
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20100728/969789ef/attachment-0001.ksh>


More information about the Fortran mailing list