From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,a7ce27b599c77060,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!news4.google.com!news2.volia.net!npeer.de.kpn-eurorings.net!newsfeed.cw.net!cw.net!news-FFM2.ecrc.de!skynet.be!peer-uk.news.demon.net!kibo.news.demon.net!news.demon.co.uk!demon!diphi.demon.co.uk!jpt From: JP Thornley Newsgroups: comp.lang.ada Subject: Elaboration problem with a task Date: Thu, 5 Jan 2006 10:04:02 +0000 Message-ID: NNTP-Posting-Host: diphi.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain;charset=us-ascii;format=flowed X-Trace: news.demon.co.uk 1136455523 16414 80.177.171.182 (5 Jan 2006 10:05:23 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Thu, 5 Jan 2006 10:05:23 +0000 (UTC) User-Agent: Turnpike/6.04-S () Xref: g2news1.google.com comp.lang.ada:2443 Date: 2006-01-05T10:04:02+00:00 List-Id: I'm getting an elaboration error and I don't understand why. It seems to be caused by having a task in a package body that calls a procedure in a child of that package. Various restructurings, such as moving the task to a second child package, have failed to clear the error. I'm using Gnat 3.15p (GPS 2.1.0 on XP Pro). The error goes away if I replace the direct call to the procedure in the child (Child_C1.Proc1 in the code) by an indirect call to a local procedure in the package body that then makes the call (Parent_Proc2) but I guess that is only hiding the problem rather than solving it. with Parent_P; procedure Proc_P is begin Parent_P.Parent_Proc1; end Proc_P; package Parent_P is procedure Parent_Proc1; private Data1 : Integer; end Parent_P; with Parent_P.Child_C1; package body Parent_P is procedure Parent_Proc1 is begin null; end Parent_Proc1; procedure Parent_Proc2 is begin Child_C1.Proc1 (Data1); end Parent_Proc2; task Parent_T; task body Parent_T is begin Child_C1.Proc1 (Data1); end Parent_T; end Parent_P; package Parent_P.Child_C1 is procedure Proc1 (P1 : in Integer); end Parent_P.Child_C1; package body Parent_P.Child_C1 is procedure Proc1 (P1 : in Integer) is begin null; end Proc1; end Parent_P.Child_C1; gnatbind -static -x proc_p.ali error: elaboration circularity detected info: "parent_p (body)" must be elaborated before "parent_p (body)" info: reason: Elaborate_All probably needed in unit "parent_p (body)" info: recompile "parent_p (body)" with -gnatwl for full details info: "parent_p (body)" info: must be elaborated along with its spec: info: "parent_p (spec)" info: which is withed by: info: "parent_p.child_c1 (spec)" info: which is withed by: info: "parent_p (body)" gnatmake: *** bind failed. Adding pragma Elaborate_All(Parent_P.Child_C1); to the body of Parent_P (as suggested) produces the same error except that the pragma is now given as the reason for the circularity. Using -gnatwl doesn't produce any additional information. An unexpected part of the error message is that the body of Parent_P "must be elaborated along with its spec". Can anyone explain why this is or otherwise suggest how to avoid the problem. Cheers, and TIA, Phil Thornley -- JP Thornley