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:6415:: with SMTP id y21mr1274223qkb.258.1587288497461; Sun, 19 Apr 2020 02:28:17 -0700 (PDT) X-Received: by 2002:aca:fc57:: with SMTP id a84mr7090219oii.37.1587288497204; Sun, 19 Apr 2020 02:28:17 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!fdn.fr!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 02:28:17 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: google-groups.googlegroups.com; posting-host=185.22.143.91; posting-account=rmHyLAoAAADSQmMWJF0a_815Fdd96RDf NNTP-Posting-Host: 185.22.143.91 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: GNAT CE 2019 bug: Predicate check not performed From: AdaMagica Injection-Date: Sun, 19 Apr 2020 09:28:17 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader01.eternal-september.org comp.lang.ada:58417 Date: 2020-04-19T02:28:17-07:00 List-Id: 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; procedure Ass is pragma Assertion_Policy (Check); subtype String_5 is String with Dynamic_Predicate => String_5'First = 5; procedure P (X: String_5) is begin Put_Line ("P expects 5:" & X'First'Image); end P; procedure Q (X: String) is begin P (X); -- Why no predicate check here? end Q; S: constant String := "Lady Ada"; begin begin Q (S); -- prints 1, expected Assertion_Error Put_Line ("Problem Q: Assertion_Error not raised."); exception when Assertion_Error => Put_Line ("Q: Assertion_Error raised as expected."); end; begin P (S); -- Assertion_Error raised here Put_Line ("Problem P: Assertion_Error not raised."); exception when Assertion_Error => Put_Line ("P: Assertion_Error raised as expected."); end; 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