[gfortran,patch] PR 27895, compile-time bounds checking for array section
FX Coudert
fxcoudert@gmail.com
Mon Jun 5 20:17:00 GMT 2006
Much improved patch for the same problem, with the same description.
I also fixed the case of:
print *, a(-5:-5:n)
which will now give a warning even if we don't know the value of n.
OK for mainline and 4.1?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: compiletime_bounds_checking.ChangeLog
Type: application/octet-stream
Size: 389 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20060605/6d252bdc/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: compiletime_bounds_checking.diff
Type: application/octet-stream
Size: 6811 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20060605/6d252bdc/attachment-0001.obj>
-------------- next part --------------
> Attached patch corrects the compile-time bounds checking code for
> array sections by properly taking care of zero-sized sections. It also
> enables the front-end to check not only the first element in the
> sequence specified by a given triplet, but also the last one. It does
> this by adding a function compute_last_value_for_triplet.
>
> This allows us to emit warnings for out-of-bounds access in cases we
> didn't detect before, such as:
> integer a(10)
> print *, a(1:12:3)
> while avoiding messages in cases such as
> integer a(10)
> print *, a(1:11:3)
>
> The patch is regtested on i686-linux, and comes with a testcase
> covering all the possible situations I could think of. OK for mainline
> and 4.1?
More information about the Gcc-patches
mailing list