[Ada] Fix negative numbers formatted with leading zero
authorPascal Obry <obry@adacore.com>
Thu, 16 Sep 2021 14:23:55 +0000 (16:23 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Tue, 5 Oct 2021 08:20:04 +0000 (08:20 +0000)
gcc/ada/

* libgnat/g-forstr.adb (Get_Formatted): Fix computation of the
number of zero to use in the formatted string. This was a wrong
copy/paste.

gcc/ada/libgnat/g-forstr.adb

index 71d17f1..d659612 100644 (file)
@@ -424,7 +424,7 @@ package body GNAT.Formatted_String is
         and then F_Spec.Zero_Pad
         and then F_Spec.Width > Len + Value'First - S
       then
-         Append (Res, String'((F_Spec.Width - Len + Value'First - S) * '0'));
+         Append (Res, String'((F_Spec.Width - (Len + Value'First - S)) * '0'));
       end if;
 
       --  Add the value now