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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 2002:a05:6214:583:: with SMTP id bx3mr12611946qvb.231.1587335556801; Sun, 19 Apr 2020 15:32:36 -0700 (PDT) X-Received: by 2002:a9d:7ad8:: with SMTP id m24mr7807404otn.22.1587335556568; Sun, 19 Apr 2020 15:32:36 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!feeder1.feed.usenet.farm!feeder5.feed.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 19 Apr 2020 15:32:36 -0700 (PDT) In-Reply-To: <3dc6396a-fdbe-4da1-b806-d54ac76c1a3f@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: google-groups.googlegroups.com; posting-host=67.164.24.162; posting-account=Qh2kiQoAAADpCLlhT_KTYoGO8dU3n4I6 NNTP-Posting-Host: 67.164.24.162 References: <3dc6396a-fdbe-4da1-b806-d54ac76c1a3f@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <0a4df528-a44c-433d-9ac6-47e6fe68862b@googlegroups.com> Subject: Re: GNAT CE 2019 bug: Predicate check not performed From: Anh Vo Injection-Date: Sun, 19 Apr 2020 22:32:36 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader01.eternal-september.org comp.lang.ada:58423 Date: 2020-04-19T15:32:36-07:00 List-Id: On Sunday, April 19, 2020 at 3:31:15 PM UTC-7, Anh Vo wrote: > On Sunday, April 19, 2020 at 2:28:18 AM UTC-7, AdaMagica wrote: > > The problem is with GNAT CE 2019. > > GNAT CE 2018 was correct. > > ------------------------------------------------ > > with Ada.Text_IO; > > use Ada.Text_IO; > > with Ada.Assertions; > > use Ada.Assertions; > >=20 > > procedure Ass is > >=20 > > pragma Assertion_Policy (Check); > >=20 > > subtype String_5 is String with Dynamic_Predicate =3D> String_5'First= =3D 5; > >=20 > > procedure P (X: String_5) is > > begin > > Put_Line ("P expects 5:" & X'First'Image); > > end P; > >=20 > > procedure Q (X: String) is > > begin > > P (X); -- Why no predicate check here? > > end Q; > >=20 > > S: constant String :=3D "Lady Ada"; > >=20 > > begin > >=20 > > begin > > Q (S); -- prints 1, expected Assertion_Error > > Put_Line ("Problem Q: Assertion_Error not raised."); > > exception > > when Assertion_Error =3D> Put_Line ("Q: Assertion_Error raised as e= xpected."); > > end; > >=20 > > begin > > P (S); -- Assertion_Error raised here > > Put_Line ("Problem P: Assertion_Error not raised."); > > exception > > when Assertion_Error =3D> Put_Line ("P: Assertion_Error raised as e= xpected."); > > end; > >=20 > > end Ass; > > --------------------- > > Result GNAT CE 2018 > > C:\Users\Grein\Documents\Christoph\Ada\Spielplatz\ausprobieren.exe > > Q: Assertion_Error raised as expected. > > P: Assertion_Error raised as expected. > > [2020-04-18 19:33:34] process terminated successfully, elapsed time: 07= .47s > > Result GNAT CE 2019 > > C:\Users\Grein\Documents\Christoph\Ada\Spielplatz\ausprobieren.exe > > P expects 5: 1 > > Problem Q: Assertion_Error not raised. > > P: Assertion_Error raised as expected. > > [2020-04-18 19:58:20] process terminated successfully, elapsed time: 04= .25s >=20 > It takes time to look thru the LRM to if this behavior is expected or not= . However if String_5 is changed to type and lines 19 and 34 are adjusted f= or compilation, then it behaves as in GNAT CE 2018. By the way, GNAT Commun= ity 2019 on Windows 10 is for this check. It takes time to look thru the LRM to see if...