Commit 1d6c2060 by Piotr Trojanek Committed by Pierre-Marie de Rodat

[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  <trojanek@adacore.com>

gcc/ada/

	* sem.adb (Walk_Library_Items): Skip units with configuration pragmas
	when printing debug info.

From-SVN: r262720
parent bf6ff5e5
2018-07-16 Piotr Trojanek <trojanek@adacore.com> 2018-07-16 Piotr Trojanek <trojanek@adacore.com>
* sem.adb (Walk_Library_Items): Skip units with configuration pragmas
when printing debug info.
2018-07-16 Piotr Trojanek <trojanek@adacore.com>
* sem.adb (Walk_Library_Items): Reuse local constant. * sem.adb (Walk_Library_Items): Reuse local constant.
(Is_Subunit_Of_Main): Turn condition to positive and flip the (Is_Subunit_Of_Main): Turn condition to positive and flip the
IF-THEN-ELSE branches; avoid potentially ineffective assignment to the IF-THEN-ELSE branches; avoid potentially ineffective assignment to the
......
...@@ -2242,9 +2242,15 @@ package body Sem is ...@@ -2242,9 +2242,15 @@ package body Sem is
for Unit_Num in Done'Range loop for Unit_Num in Done'Range loop
if not Done (Unit_Num) then if not Done (Unit_Num) then
-- 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 Write_Unit_Info
(Unit_Num, Unit (Cunit (Unit_Num)), Withs => True); (Unit_Num, Unit (Cunit (Unit_Num)), Withs => True);
end if; end if;
end if;
end loop; end loop;
Outdent; Outdent;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment