]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Avoid crash on node extension
authorBob Duff <duff@adacore.com>
Fri, 15 May 2020 15:40:50 +0000 (11:40 -0400)
committerPierre-Marie de Rodat <derodat@adacore.com>
Tue, 7 Jul 2020 09:27:00 +0000 (05:27 -0400)
gcc/ada/

* treepr.adb (Print_Node): Add code to test Is_Extension.

gcc/ada/treepr.adb

index b84af01d40f4c52435d2050a714f428d4afe37db..b4fd54561659df7a94de92c15c91777b57da2e50 100644 (file)
@@ -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;