With recently enabled data validity checking in development builds
routine "ps", when called from gdb to examine the AST, might crash on
invalid data.  This is because its Sprint_Node_Actual callee reads
Dump_Freeze_Null global variable when processing nodes of
N_Freeze_Entity and this global variable is not initialized by default.

Found while working on inheritance of the Default_Initial_Condition
pragma.  Compilation is not affected.

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

gcc/ada/

        * sprint.adb (po): Set Dump_Freeze_Null to False; align colons.
        (ps): Likewise.
diff --git a/gcc/ada/sprint.adb b/gcc/ada/sprint.adb
--- a/gcc/ada/sprint.adb
+++ b/gcc/ada/sprint.adb
@@ -441,7 +441,8 @@ package body Sprint is
    procedure po (Arg : Union_Id) is
    begin
       Dump_Generated_Only := False;
-      Dump_Original_Only := True;
+      Dump_Original_Only  := True;
+      Dump_Freeze_Null    := False;
       Current_Source_File := No_Source_File;
 
       if Arg in List_Range then
@@ -473,7 +474,8 @@ package body Sprint is
    procedure ps (Arg : Union_Id) is
    begin
       Dump_Generated_Only := False;
-      Dump_Original_Only := False;
+      Dump_Original_Only  := False;
+      Dump_Freeze_Null    := False;
       Current_Source_File := No_Source_File;
 
       if Arg in List_Range then


Reply via email to