This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [gfortran,patch] Fix PR27588: Add substring out of bounds check
Hi,
Steve Kargl schrieb:
>> The output error is (e.g.):
>> Fortran runtime error: Substring out of bounds: lower bound is less than
>> one (in file 'string2.f90', at line 5)
>>
>
> I think the error message would read better without the parenthesis and comma.
>
> Fortran runtime error: Substring out of bounds: upper bound exceeds
> string length in file 'cbnd1.for' at line 5
>
> or
>
> Fortran runtime error: In file 'cbnd1.for' at line 5, substring out of
> bounds because upper bound exceeds string length
>
No problem with changing this; this has, however, nothing to to with
this patch as gfc_trans_runtime_check is shared by (at least) the array
bound tests.
Actually, I prefer the former: (what happened, where did it happen)
rather than (where did it happen, what did happen actually?); and
without "()" it also looks nicer.
If anyone is in favour of it, I can create a proper patch (and check the
testcases to make sure they don't break).
Tobias
--- gcc/fortran/trans.c (working copy)
*************** gfc_trans_runtime_check (tree cond, cons
*** 329,339 ****
! asprintf (&message, "%s (in file '%s', at line %d)", _(msgid),
! asprintf (&message, "%s (in file '%s', around line %d)", _(msgid),
--- 329,339 ----
! asprintf (&message, "%s in file '%s' at line %d", _(msgid),
! asprintf (&message, "%s in file '%s' around line %d", _(msgid),