From: Ronan Desplanques <desplanq...@adacore.com>

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.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/libgnat/s-imager.adb | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gcc/ada/libgnat/s-imager.adb b/gcc/ada/libgnat/s-imager.adb
index c598cc94e15..d19fda3b613 100644
--- a/gcc/ada/libgnat/s-imager.adb
+++ b/gcc/ada/libgnat/s-imager.adb
@@ -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;
 
    -----------------
-- 
2.43.0

Reply via email to