This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gfortran,patch] Fix PR27588: Add substring-out-of-bounds check


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]