From: Phil Thornley <phil.jpthornley@googlemail.com>
Subject: Re: SPARK again : for-loop vs single loop - a strange case
Date: Fri, 28 May 2010 08:13:57 -0700 (PDT)
Date: 2010-05-28T08:13:57-07:00 [thread overview]
Message-ID: <22bd64db-4c71-4856-a60f-f9b2411ab23b@v18g2000vbc.googlegroups.com> (raw)
In-Reply-To: eb1871bc-62d0-411c-b96e-97f8c8e148f6@f14g2000vbn.googlegroups.com
On 28 May, 12:50, Phil Thornley <phil.jpthorn...@googlemail.com>
wrote:
> This thread persuaded me to finally check precisely what the Examiner
> generates for local variables (I have always just assumed that it
> doesn't do anything - looking back through the release notes, this
> changed in Release 7.2).
>
> The statement about this is in GenRTCs section 4.5.2.1; hypotheses are
> generated that local variables are in-type if various conditions are
> met that ensure that no out-of-type value can be assigned in the
> procedure (no 'significant' data flow errors, no read from external
> variables and no use of Unchecked_Conversion).
I seem to have reproduced the same problem as Yannick.
Here is the code:
subtype Index is Integer range 1 .. 10;
type Arr is array(Index) of Integer;
procedure Zero_Part (A : in out Arr;
U : in Index)
--# derives A from *, U;
is
I : Index;
begin
I := 1;
loop
A(I) := 0;
exit when I >= U;
I := I + 1;
end loop;
end Zero_Part;
As I understand the documentation the default assertion should include
hypotheses that I is in-type, but when simplified there are two
conclusions left for the A(I) := 0; assignment:
C1: i >= 1 .
C2: i <= 10 .
If I add the assertion:
--# assert I in Index;
then these conclusions are proved by the Simplifier.
So either my understanding of how the Examiner generates hypotheses is
wrong or the Examiner is wrong.
Cheers,
Phil
next prev parent reply other threads:[~2010-05-28 15:13 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-27 19:36 SPARK again : for-loop vs single loop - a strange case Yannick Duchêne (Hibou57)
2010-05-27 21:50 ` Brian Drummond
2010-05-27 23:21 ` Yannick Duchêne (Hibou57)
2010-05-28 8:14 ` Phil Thornley
2010-05-28 9:00 ` Yannick Duchêne (Hibou57)
2010-05-28 11:50 ` Phil Thornley
2010-05-28 15:13 ` Phil Thornley [this message]
2010-05-28 22:46 ` Yannick Duchêne (Hibou57)
2010-05-28 22:41 ` Yannick Duchêne (Hibou57)
2010-05-28 9:04 ` Yannick Duchêne (Hibou57)
2010-05-28 12:17 ` stefan-lucks
2010-05-28 22:52 ` Yannick Duchêne (Hibou57)
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox