Le 27/04/2015 20:45, Thomas Koenig a écrit : > Am 25.04.2015 um 20:12 schrieb Mikael Morin: > >> I've double-checked in the standard, and it seems it is not possible to >> simplify after all: >> >> If ARRAY is a whole array and either ARRAY is an assumed-size >> array of rank DIM or dimension DIM of ARRAY has nonzero extent, >> LBOUND (ARRAY, DIM) has a value equal to the lower bound for >> subscript DIM of ARRAY. Otherwise the result value is 1. >> >> We can't tell whether the array is zero-sized, so we can't tell the >> lbound value. > > So it is only possible to simplify LBOUND if the lower bound is > equal to one, both for assumed-shape and explicit-shape arrays... > Indeed.
>> As you may want to simplify in the limited scope of the matmul inlining, >> I'm giving comments about the patch (otherwise you can ignore them): >> - No need to check for allocatable or pointer, it should be excluded by >> as->type == AS_ASSUMED_SHAPE (but does no harm either). > > Actually, no. You can have assumed-shape allocatable or pointer > dummy arguments which keep their original lbound; see the subroutine > 'bar' in the test case. > >> - Please modify the early return condition: >> if (as && (as->type == AS_DEFERRED || as->type == AS_ASSUMED_SHAPE >> || as->type == AS_ASSUMED_RANK)) >> return NULL; >> and let the existing code do the simplification work. > > That is not part of my patch. > I'm not sure I expressed what I was asking for clearly enough. Anyway, I may as well submit the requested changes myself. > So... here is the new patch. OK for trunk? > Yes, thanks. Mikael