From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1914) id AC190385703A; Tue, 5 Oct 2021 08:23:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AC190385703A MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Pierre-Marie de Rodat To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-4166] [Ada] Issue a proper error message when no format specifier found X-Act-Checkin: gcc X-Git-Author: Pascal Obry X-Git-Refname: refs/heads/master X-Git-Oldrev: 657d0d8faf8a9f5d0c221fa011cd66ae815e9a59 X-Git-Newrev: f7d1d2c250e2d8d3892d620924795c10b6809337 Message-Id: <20211005082356.AC190385703A@sourceware.org> Date: Tue, 5 Oct 2021 08:23:56 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Oct 2021 08:23:56 -0000 https://gcc.gnu.org/g:f7d1d2c250e2d8d3892d620924795c10b6809337 commit r12-4166-gf7d1d2c250e2d8d3892d620924795c10b6809337 Author: Pascal Obry 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;