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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,113cbde0422b98e8 X-Google-Attributes: gid103376,public From: "Samuel A. Mize" Subject: Re: Why no constraint error? Date: 1997/03/24 Message-ID: <33369ACC.41C6@magellan.bgm.link.com>#1/1 X-Deja-AN: 227979291 References: Organization: PSI Public Usenet Link Newsgroups: comp.lang.ada Date: 1997-03-24T00:00:00+00:00 List-Id: Tucker Taft wrote: > Well Bob, I believe GNAT is technically right in this one, though > I think it may be pessimizing the code overall if it follows > the approach implied by the above (see below for more discussion). Sorry -- "pessimizing?" Could you supply a definition for the less experienced? Do you mean "making less efficient through excessive pessimism?" Thanks. > One thing to keep in mind is that "out of the box" GNAT suppresses > certain run-time checks (not my favorite feature of GNAT, I might say ;-). > I trust this was compiled with all checks *on*... It was. > In this particular case, the propagation of an uninitialized > value from one variable to another is relatively benign, since > no memory is being trashed by this propagation. The real question > is what happens when "Target" is used as an index into an array. > Does GNAT remember that Target might become deinitialized by the > assignment, and hence do the check when Target is used as an index? No. > Or does GNAT see that Target is initialized to a valid value, and > presume that it never becomes deinitialized. No. I tested the array case with a straight uninitialized variable, and it indexed to it. (I used Normalize_Scalars to get a predictable value, but I don't *think* this would impact the presence/absence of this range check.) > In our AdaMagic front end, objects are identified by the compiler > as either "reliable" or "unreliable." ... This sounds slick. I'll look at your web site. > I'm curious what approach GNAT adopts, and whether the above > would in fact reveal a bug if Target were used as an array index... No, it doesn't. > > -Tucker Taft stt@inmet.com http://www.inmet.com/~stt/ > Intermetrics, Inc. Burlington, MA USA Sam Mize (same Sam Mize, different account -- opinions are my own) -- Samuel Mize (817) 619-8622 "Team Ada" Hughes Training Inc. PO Box 6171 m/s 400, Arlington TX 76005