ada: Fix parsing bug in GNAT.Formatted_String
authorRonan Desplanques <desplanques@adacore.com>
Fri, 9 Dec 2022 10:29:02 +0000 (11:29 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 3 Jan 2023 09:29:54 +0000 (10:29 +0100)
Before this patch, GNAT.Formatted_String.Formatted_String failed to
handle format strings with two or more specifiers whose widths were
specified with the "*" syntax. This patch makes the parser
correctly reset its bits of state related to width and precision
parsing when needed.

gcc/ada/

* libgnat/g-forstr.adb (P_Int_Format): Fix parsing bug.

gcc/ada/libgnat/g-forstr.adb

index 8353e2c4ad864773cc52ccaf95324654a4b1f3bd..c9fb86b44f77fa6f6b8a55bc4f99fbd0e4f93109 100644 (file)
@@ -808,6 +808,7 @@ package body GNAT.Formatted_String is
          Format.D.Index := Start;
          return Format;
       end if;
+      Format.D.Stored_Value := 0;
 
       case F.Kind is
          when Unsigned_Octal =>