From e997d94b298c5ea753b613c38518a2c72bdf44af Mon Sep 17 00:00:00 2001 From: Bob Duff Date: Fri, 15 May 2020 11:40:50 -0400 Subject: [PATCH] [Ada] Avoid crash on node extension gcc/ada/ * treepr.adb (Print_Node): Add code to test Is_Extension. --- gcc/ada/treepr.adb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gcc/ada/treepr.adb b/gcc/ada/treepr.adb index b84af01d40f..b4fd5456165 100644 --- 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; -- 2.30.2