public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-3043] Fortran - use temporary char buffer for passing HOST_WIDE_INT to gfc_error
@ 2021-08-20 11:38 Harald Anlauf
0 siblings, 0 replies; only message in thread
From: Harald Anlauf @ 2021-08-20 11:38 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:12f22906d3c025e7edb60e3264dc9cd27a49e3e1
commit r12-3043-g12f22906d3c025e7edb60e3264dc9cd27a49e3e1
Author: Harald Anlauf <anlauf@gmx.de>
Date: Fri Aug 20 13:38:00 2021 +0200
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.
Diff:
---
gcc/fortran/simplify.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index 492867e12cb..eaabbffca4d 100644
--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -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;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-08-20 11:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-20 11:38 [gcc r12-3043] Fortran - use temporary char buffer for passing HOST_WIDE_INT to gfc_error Harald Anlauf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).