[gfortran,patch] Fix PR27588: Add substring-out-of-bounds check
Tobias Burnus
burnus@net-b.de
Sun Nov 19 13:43:00 GMT 2006
Hi,
FX Coudert wrote:
>> FX wrote (regarding his patch): "I've been working to find how to output
>> the variable name, [...] but it still doesn't work in all cases."
>
> Looking for one is easy: simply add a gcc_assert(name) inside
> gfc_conv_substring (but outside the "if (flag_bounds_check)" block),
> rebuild and run the testsuite: if there are new failures, then you
> have your case you can (happily) look into it ;-)
>
> Even if you don't have time to do it, I'd suggest opening a PR with
> the restults of the procedure (it can also be applied on the array
> bounds checking code).
I did this test (PR 29892). Result using the test suite:
- In gfc_conv_variable: Always defined
- In gfc_conv_substring_expr:
Two cases:
a(i1, i2, i3) = 'ab'(i1:i1) // 'cde'(i2:i2) // 'fghi'(i3:i3)
=> No "name" possible
and
character(len=16),parameter :: s = "", s2 = "1234567890123456"
print *, s(9:16)
print *, s2(9:16)
i.e. character parameters. (I don't plan to look at this in the near
future.)
Tobias
More information about the Fortran
mailing list