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.5 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM,TO_NO_BRKTS_PCNT autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,421f00454ed1208d,start X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!f16g2000vbf.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: SPARK - runtime checks question Date: Fri, 19 Jun 2009 08:26:39 -0700 (PDT) Organization: http://groups.google.com Message-ID: <8d79ac48-d35d-4717-aca3-68f036de0de3@f16g2000vbf.googlegroups.com> NNTP-Posting-Host: 137.138.182.236 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1245425200 8706 127.0.0.1 (19 Jun 2009 15:26:40 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 19 Jun 2009 15:26:40 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: f16g2000vbf.googlegroups.com; posting-host=137.138.182.236; posting-account=bMuEOQoAAACUUr_ghL3RBIi5neBZ5w_S User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.11) Gecko/2009060214 Firefox/3.0.11,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:6537 Date: 2009-06-19T08:26:39-07:00 List-Id: Consider the following: -- my_package.ads: package My_Package is function Distance (X : in Natural; Y : in Natural) return Natural; end My_Package; -- my_package.adb: package body My_Package is function Distance (X : in Natural; Y : in Natural) return Natural is Result : Natural; begin if X > Y then Result := X - Y; // line 8 else Result := Y - X; // line 10 end if; return Result; end Distance; end My_Package; The Distance function is supposed to compute the distance between two Naturals. I have a problem with rtc checks that are generated for line 8 and 10. After running spark -vcg, sparksimp and pogs, the spark.sum file contains this: VCs for function_distance : ---------------------------------------------------------------------------- | | | -----Proved In----- | | | # | From | To | vcg | siv | plg | prv | False | TO DO | ---------------------------------------------------------------------------- 1 | start | rtc check @ 8 | | | | | | YES | 2 | start | rtc check @ 10 | | | | | | YES | 3 | start | assert @ finish | | YES | | | | | 4 | start | assert @ finish | | YES | | | | | ---------------------------------------------------------------------------- and of course 50% of VCs are undischarged in the final report. As far as I understand the math, the relevant values are always within the target type. What am I missing in this simple example? -- Maciej Sobczak * www.msobczak.com * www.inspirel.com Database Access Library for Ada: www.inspirel.com/soci-ada