Value Range Propagation Patch (Version 4)
Toon Moene
toon@moene.indiv.nluug.nl
Tue Jul 25 11:17:00 GMT 2000
John Wehle wrote:
[ ... ]
Great way to solve my first puzzle. Now I have another one (of course
:-).
Given the following source:
subroutine aap(a, n)
dimension a(n)
do i = 1, n
a(i) = i
enddo
end
VRP cannot determine that the range test by array bound checking is
superfluous (because n is not a constant, and hence not subject to
*value* range propagation).
However, it should be possible to determine that `i' can never have a
value less than the lower bound of the array `a' (which is 1 by default)
because both are constants.
Unfortunately, this doesn't happen ...
[ This would result in over half of the comparisons in array bounds
checking to be removed, because Fortran code seldomly has _both_
upper _and_ lower bounds non-constant. ]
Cheers,
--
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
GNU Fortran 95: http://g95.sourceforge.net/ (under construction)
More information about the Gcc-patches
mailing list