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=unavailable autolearn_force=no version=3.4.4 X-Google-Thread: 103376,b0a828f417615ded X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!club-internet.fr!feedme-small.clubint.net!nuzba.szn.dk!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Compiler Bug Date: Wed, 5 Dec 2007 21:30:08 -0600 Organization: Jacob's private Usenet server Message-ID: References: <9f4bc0eb-d44a-43f9-83bd-dd07fa8538f2@i12g2000prf.googlegroups.com> <8a6283ea-be44-46d7-a2f1-a6d626266b58@p69g2000hsa.googlegroups.com> <97d0825d-ee08-45ef-b736-ca005caf1a81@e23g2000prf.googlegroups.com> <24d8f3b3-8406-4bc2-8908-f85c84a4bd69@e10g2000prf.googlegroups.com> <877ijtzd6q.fsf@willow.rfc1149.net> <9984a3f8-1e45-44c0-96d6-4bd9462c57d5@d27g2000prf.googlegroups.com> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: jacob-sparre.dk 1196983694 9125 69.95.181.76 (6 Dec 2007 23:28:14 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Thu, 6 Dec 2007 23:28:14 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1914 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1914 Xref: g2news1.google.com comp.lang.ada:18750 Date: 2007-12-05T21:30:08-06:00 List-Id: "Adam Beneschan" wrote in message news:9984a3f8-1e45-44c0-96d6-4bd9462c57d5@d27g2000prf.googlegroups.com... ... > I think this is such an example. It's possible that I'm technically > wrong about what the language requires, though; if so, I'm hoping one > of the other language experts will jump in. Some of the language > rules about optimization have, I think, always been seen as a bit > fuzzy. > > > subtype Int10 is Integer range 1..10; > > procedure P1 (X : in Int10; Y, Z : out Int10) is > begin > Y := X + 1; > Z := X + 5; > end P1; > > procedure P2 is > A1, A2, A3 : Int10; > begin > ... code whose effect puts the value 6 in A1 > P1 (A1, A2, A3); > ... code that uses A2 but does nothing with A3 > end P2; > > > Without any inlining, a Constraint_Error will surely be raised when P1 > assigns to Z. If P1 is inlined, however, the compiler could change > the call to P1 to code that, in effect, performs "A2 := A1 + 1; A3 := > A1 + 5;"; then it could notice that since A3 is a local variable and > is used in the remainder of P2, the assignment "A3 := A1 + 5" is > pointless and can be eliminated---and thus the Constraint_Error would > not be raised. I believe the Implementation Permissions of 11.6 allow > this result. I think that you are right in this case. If there were exception handlers in the code, then some optimizations wouldn't be allowed. Randy.