From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=BAYES_00,PDS_OTHER_BAD_TLD autolearn=no autolearn_force=no version=3.4.5-pre1 Date: 30 Aug 93 07:24:02 GMT From: cis.ohio-state.edu!math.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.i ns.cwru.edu!howland.reston.ans.net!usc!cs.utexas.edu!hermes.chpc.utexas.edu!new s.utdallas.edu!convex!pelakh@ucbvax. (Boris Pelakh) Subject: Re: Access before Elaboration (was Re: Odd Generic Behaviour < List-Id: In article <1993Aug27.111311.24900@sei.cmu.edu> jbg@sei.cmu.edu (John Goodenoug h) writes: >Although this sounds good at first, the Convex Ada compiler is wrong here, >because it doesn't raise PROGRAM_ERROR when the generic instantiation is >elaborated (as pointed out by Sandy Wise). One might well ask why these pesky >elaboration errors are defined in the language at all, and this gives a simple >opportunity to show the language semantics issues. Consider a modification of >the original example: > > [Code removed] > >Note that the elaboration of NEWGEN1's body as part of the elaboration of the >generic instantiation causes STUFF.TOP to be set to 12 **before** the STUFF >package has itself been elaborated. Because of access before elaboration >checks, the language doesn't define what the value of STUFF.TOP is in the main >program or what the value of A'LAST is. It wouldn't surprise me if the Convex >Ada compiler blew up at compile time or at execution time on this example, but >even if it doesn't, it is executing an incorrect program whose behavior is not >defined by the language. What happend is that the static initialization of stuff.top was done at compile time, so the value 10 was there when the program started running, and thus a'last was 10. The the generic body was elaborated, and the value was 12 at the beginning of the program. I see your point though. If there was a use of stuff.top later in pack1 spec, it would expect the value to be 10, where as it would already be 12. As a matter of fact, I have just checked the most recent Verdix compiler (6.2) and this is already fixed, and thus will be picked up for the next Convex Ada release. Not a day without learning something :) -- Boris Pelakh Ada Project Leader pelakh@convex.com Convex Computer Corporation "If winning isn't important, why keep score ?" -- Lt. Worf, Star Trek TNG.