From: AdaMagica <christ-usch.grein@t-online.de>
Subject: GNAT CE 2019 bug: Predicate check not performed
Date: Sun, 19 Apr 2020 02:28:17 -0700 (PDT)
Date: 2020-04-19T02:28:17-07:00 [thread overview]
Message-ID: <df8a5155-3949-48cb-afa3-887e27a520f5@googlegroups.com> (raw)
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
next reply other threads:[~2020-04-19 9:28 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-19 9:28 AdaMagica [this message]
2020-04-19 22:31 ` GNAT CE 2019 bug: Predicate check not performed Anh Vo
2020-04-19 22:32 ` Anh Vo
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