Fortran - use temporary char buffer for passing HOST_WIDE_INT to gfc_error
gcc/fortran/ChangeLog: PR fortran/100950 * simplify.c (substring_has_constant_len): Fix format string of gfc_error, pass HOST_WIDE_INT bounds values via char buffer.
This commit is contained in:
parent
37744f8260
commit
12f22906d3
@ -4552,11 +4552,12 @@ substring_has_constant_len (gfc_expr *e)
|
||||
|
||||
if (istart <= iend)
|
||||
{
|
||||
char buffer[21];
|
||||
if (istart < 1)
|
||||
{
|
||||
gfc_error ("Substring start index (" HOST_WIDE_INT_PRINT_DEC
|
||||
") at %L below 1",
|
||||
istart, &ref->u.ss.start->where);
|
||||
sprintf (buffer, HOST_WIDE_INT_PRINT_DEC, istart);
|
||||
gfc_error ("Substring start index (%s) at %L below 1",
|
||||
buffer, &ref->u.ss.start->where);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -4567,9 +4568,9 @@ substring_has_constant_len (gfc_expr *e)
|
||||
length = gfc_mpz_get_hwi (ref->u.ss.length->length->value.integer);
|
||||
if (iend > length)
|
||||
{
|
||||
gfc_error ("Substring end index (" HOST_WIDE_INT_PRINT_DEC
|
||||
") at %L exceeds string length",
|
||||
iend, &ref->u.ss.end->where);
|
||||
sprintf (buffer, HOST_WIDE_INT_PRINT_DEC, iend);
|
||||
gfc_error ("Substring end index (%s) at %L exceeds string length",
|
||||
buffer, &ref->u.ss.end->where);
|
||||
return false;
|
||||
}
|
||||
length = iend - istart + 1;
|
||||
|
Loading…
Reference in New Issue
Block a user