comp.lang.ada
 help / color / mirror / Atom feed
From: Anh Vo <anhvofrcaus@gmail.com>
Subject: Re: GNAT CE 2019 bug: Predicate check not performed
Date: Sun, 19 Apr 2020 15:32:36 -0700 (PDT)
Date: 2020-04-19T15:32:36-07:00	[thread overview]
Message-ID: <0a4df528-a44c-433d-9ac6-47e6fe68862b@googlegroups.com> (raw)
In-Reply-To: <3dc6396a-fdbe-4da1-b806-d54ac76c1a3f@googlegroups.com>

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;
> > 
> > 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
> 
> 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 Community 2019 on Windows 10 is for this check.

It takes time to look thru the LRM to see if...

  reply	other threads:[~2020-04-19 22:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-19  9:28 GNAT CE 2019 bug: Predicate check not performed AdaMagica
2020-04-19 22:31 ` Anh Vo
2020-04-19 22:32   ` Anh Vo [this message]
2020-04-20 10:04     ` AdaMagica
2020-04-20 20:25       ` Anh Vo
2020-04-21  0:53         ` AdaMagica
2020-04-21  2:59           ` Anh Vo
2020-04-21  7:45             ` Simon Wright
2020-04-27  6:29               ` William J. Franck
2020-04-21  5:14           ` Per Sandberg
2020-04-21  7:34             ` AdaMagica
2020-04-21 16:04               ` Per Sandberg
2020-04-21  7:40           ` Simon Wright
2020-04-21 16:59             ` Optikos
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox