]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix minor display issue on invalid floats
authorRonan Desplanques <desplanques@adacore.com>
Thu, 21 Nov 2024 13:26:32 +0000 (14:26 +0100)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Thu, 12 Dec 2024 09:58:00 +0000 (10:58 +0100)
GNAT implements a format with trailing '*' signs for the Image attribute
of NaN, +inf and -inf. It was probably always intended to be the same
length as the image of 1.0, but one '*' was actually missing. This patch
fixes this.

gcc/ada/ChangeLog:

* libgnat/s-imager.adb (Image_Floating_Point): Tweak display of
invalid floating point values.

gcc/ada/libgnat/s-imager.adb

index c598cc94e15265d57563347a287709ffe16a7b12..d19fda3b613dff2ab6ffda78ec614f4d66d86754 100644 (file)
@@ -109,6 +109,7 @@ package body System.Image_R is
    is
       pragma Assert (S'First = 1);
 
+      Fore : Natural;
    begin
       --  Decide whether a blank should be prepended before the call to
       --  Set_Image_Real. We generate a blank for positive values, and
@@ -125,11 +126,13 @@ package body System.Image_R is
          --  Image_Floating_Point operation.
          S (1) := ' ';
          P := 1;
+         Fore := 1;
       else
          P := 0;
+         Fore := 2;
       end if;
 
-      Set_Image_Real (V, S, P, 1, Digs - 1, 3);
+      Set_Image_Real (V, S, P, Fore, Digs - 1, 3);
    end Image_Floating_Point;
 
    -----------------