From: Viljar Indus <[email protected]>

Put_Image should start printing the tree from the Root instead
of the First_Child.

gcc/ada/ChangeLog:

        * libgnat/a-cbmutr.adb (Put_Image): Fix the condition and starting point
        for printing the tree.
        * libgnat/a-cimutr.adb (Put_Image): Likewise.
        * libgnat/a-comutr.adb (Put_Image): Likewise.

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

---
 gcc/ada/libgnat/a-cbmutr.adb | 4 ++--
 gcc/ada/libgnat/a-cimutr.adb | 4 ++--
 gcc/ada/libgnat/a-comutr.adb | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/gcc/ada/libgnat/a-cbmutr.adb b/gcc/ada/libgnat/a-cbmutr.adb
index 9d9d21d2c39..bd6b1359f96 100644
--- a/gcc/ada/libgnat/a-cbmutr.adb
+++ b/gcc/ada/libgnat/a-cbmutr.adb
@@ -2357,11 +2357,11 @@ is
       end Rec;
 
    begin
-      if First_Child (Root (V)) = No_Element then
+      if Is_Empty (V) then
          Array_Before (S);
          Array_After (S);
       else
-         Rec (First_Child (Root (V)));
+         Rec (Root (V));
       end if;
    end Put_Image;
 
diff --git a/gcc/ada/libgnat/a-cimutr.adb b/gcc/ada/libgnat/a-cimutr.adb
index b84eb16024b..0c6d33828b1 100644
--- a/gcc/ada/libgnat/a-cimutr.adb
+++ b/gcc/ada/libgnat/a-cimutr.adb
@@ -1910,11 +1910,11 @@ is
       end Rec;
 
    begin
-      if First_Child (Root (V)) = No_Element then
+      if Is_Empty (V) then
          Array_Before (S);
          Array_After (S);
       else
-         Rec (First_Child (Root (V)));
+         Rec (Root (V));
       end if;
    end Put_Image;
 
diff --git a/gcc/ada/libgnat/a-comutr.adb b/gcc/ada/libgnat/a-comutr.adb
index df3741bbbb0..2d6393db35a 100644
--- a/gcc/ada/libgnat/a-comutr.adb
+++ b/gcc/ada/libgnat/a-comutr.adb
@@ -1844,11 +1844,11 @@ is
       end Rec;
 
    begin
-      if First_Child (Root (V)) = No_Element then
+      if Is_Empty (V) then
          Array_Before (S);
          Array_After (S);
       else
-         Rec (First_Child (Root (V)));
+         Rec (Root (V));
       end if;
    end Put_Image;
 
-- 
2.51.0

Reply via email to