If a Node_Id points to a node extension, rather than an actual node,
avoid crashing in the various debugging printouts, but just print an
indication that it's an extension.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

        * treepr.adb (Print_Node): Add code to test Is_Extension.
diff --git a/gcc/ada/treepr.adb b/gcc/ada/treepr.adb
--- a/gcc/ada/treepr.adb
+++ b/gcc/ada/treepr.adb
@@ -1006,6 +1006,15 @@ package body Treepr is
          return;
       end if;
 
+      --  Similarly, if N points to an extension, avoid crashing
+
+      if Atree_Private_Part.Nodes.Table (N).Is_Extension then
+         Print_Int (Int (N));
+         Print_Str (" is an extension, not a node");
+         Print_Eol;
+         return;
+      end if;
+
       Prefix_Str_Char (Prefix_Str'Range)    := Prefix_Str;
       Prefix_Str_Char (Prefix_Str'Last + 1) := Prefix_Char;
 


Reply via email to