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:a37:74c2:: with SMTP id p185mr12517561qkc.449.1587335473659; Sun, 19 Apr 2020 15:31:13 -0700 (PDT) X-Received: by 2002:a05:6830:19f7:: with SMTP id t23mr7609842ott.110.1587335473361; Sun, 19 Apr 2020 15:31:13 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!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:31:13 -0700 (PDT) In-Reply-To: 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: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <3dc6396a-fdbe-4da1-b806-d54ac76c1a3f@googlegroups.com> Subject: Re: GNAT CE 2019 bug: Predicate check not performed From: Anh Vo Injection-Date: Sun, 19 Apr 2020 22:31:13 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader01.eternal-september.org comp.lang.ada:58422 Date: 2020-04-19T15:31:13-07:00 List-Id: 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 exp= ected."); > 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 exp= ected."); > 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.4= 7s > 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.2= 5s 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 for= compilation, then it behaves as in GNAT CE 2018. By the way, GNAT Communit= y 2019 on Windows 10 is for this check.