From: Piotr Trojanek <troja...@adacore.com>

When GNAT was compiling a ghost unit, the ALI file wrongly suggested that this
unit required elaboration counters, which caused linking errors to non-existing
objects.

gcc/ada/ChangeLog:

        * sem_ch10.adb (Analyze_Compilation_Unit): Ignored ghost unit need no
        elaboration checks.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/sem_ch10.adb | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb
index 45aabadf21f..3a44149aeff 100644
--- a/gcc/ada/sem_ch10.adb
+++ b/gcc/ada/sem_ch10.adb
@@ -1491,6 +1491,10 @@ package body Sem_Ch10 is
                 --  No checks required if no separate spec
 
                 or else Acts_As_Spec (N)
+
+                --  No checked needed for ignored ghost units
+
+                or else Is_Ignored_Ghost_Entity (Spec_Id)
               )
             then
                --  This is a case where we only need the entity for checking to
-- 
2.43.0

Reply via email to