From 1d6c2060053f0a3adc3a43831539f2f7bb9ce44e Mon Sep 17 00:00:00 2001 From: Piotr Trojanek Date: Mon, 16 Jul 2018 14:11:37 +0000 Subject: [Ada] Avoid crash when traversing units with -gnatd.WW debug switch The debug switch -gnatd.WW enables extra info when traversing library units with Walk_Library_Items, which is used in the CodePeer and GNATprove. This routine was crashing when trying to print info about a unit with configuration pragmas (typically an .adc file). Now fixed. No test, as the crash only happens when a GNATprove backend is manually called with -gnatd.WW switch. Frontend is not affected. 2018-07-16 Piotr Trojanek gcc/ada/ * sem.adb (Walk_Library_Items): Skip units with configuration pragmas when printing debug info. From-SVN: r262720 --- gcc/ada/sem.adb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'gcc/ada/sem.adb') diff --git a/gcc/ada/sem.adb b/gcc/ada/sem.adb index 2f2f846..b80dfcf 100644 --- a/gcc/ada/sem.adb +++ b/gcc/ada/sem.adb @@ -2242,8 +2242,14 @@ package body Sem is for Unit_Num in Done'Range loop if not Done (Unit_Num) then - Write_Unit_Info - (Unit_Num, Unit (Cunit (Unit_Num)), Withs => True); + + -- Units with configuration pragmas (.ads files) have empty + -- compilation-unit nodes; skip printing info about them. + + if Present (Cunit (Unit_Num)) then + Write_Unit_Info + (Unit_Num, Unit (Cunit (Unit_Num)), Withs => True); + end if; end if; end loop; -- cgit v1.1