public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-4166] [Ada] Issue a proper error message when no format specifier found
@ 2021-10-05  8:23 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-10-05  8:23 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:f7d1d2c250e2d8d3892d620924795c10b6809337

commit r12-4166-gf7d1d2c250e2d8d3892d620924795c10b6809337
Author: Pascal Obry <obry@adacore.com>
Date:   Thu Sep 16 19:10:39 2021 +0200

    [Ada] Issue a proper error message when no format specifier found
    
    gcc/ada/
    
            * libgnat/g-forstr.adb (Next_Format): When there is no more
            format specifier found issue a proper error message instead of
            raising a contraint error.

Diff:
---
 gcc/ada/libgnat/g-forstr.adb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/ada/libgnat/g-forstr.adb b/gcc/ada/libgnat/g-forstr.adb
index d6596126a8d..04539be026c 100644
--- a/gcc/ada/libgnat/g-forstr.adb
+++ b/gcc/ada/libgnat/g-forstr.adb
@@ -519,7 +519,7 @@ package body GNAT.Formatted_String is
          J := J + 1;
       end loop;
 
-      if F (J) /= '%' or else J = F'Last then
+      if J >= F'Last or else F (J) /= '%'  then
          raise Format_Error with "no format specifier found for parameter"
            & Positive'Image (Format.D.Current);
       end if;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-10-05  8:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-05  8:23 [gcc r12-4166] [Ada] Issue a proper error message when no format specifier found Pierre-Marie de Rodat

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).