[PATCH] Fortran: improve checking of substring bounds [PR119118]

Harald Anlauf anlauf@gmx.de
Thu Mar 6 21:49:08 GMT 2025


Hi Steve,

Am 06.03.25 um 22:32 schrieb Steve Kargl:
> On Thu, Mar 06, 2025 at 10:04:08PM +0100, Harald Anlauf wrote:
>>
>> this patch fixes an interesting regression that prevented substring
>> bounds checks from being generated if the substring start was not a
>> variable, but rather a constant or an expression.
>>
>> The fix I chose turned out to be a little larger than I anticipated:
>> handling the case of an expression being used needs scanning for
>> implied-do indices.  See attached patch for details.
>>
>> Regtested on x86_64-pc-linux-gnu.  OK for mainline?
>>
>
> Bene quidem!
>
> Thanks for expanded the testcases to include implied-do.
>
> One nit below.
>
> OK to comment.
>
>> +
>> +/* Traverse expr, checking all EXPR_VARIABLE symbols for their
>> +   implied_index attribute.  Return true if any variable may be
>> +   being used as an implied-do index.  Its safe to pessimistically
>
> The word "being" can be deleted.
>
>> +   return true, and assume a dependency.  */
>

Indeed.  Fixed and pushed as r15-7873-gac8a70db59ac30.

Thanks for the speedy review!

Harald



More information about the Fortran mailing list