comp.lang.ada
 help / color / mirror / Atom feed
* SPARK - division by zero problem
@ 2013-04-18  8:14 Maciej Sobczak
  2013-04-18  8:35 ` Phil Thornley
  0 siblings, 1 reply; 3+ messages in thread
From: Maciej Sobczak @ 2013-04-18  8:14 UTC (permalink / raw)


While playing with SPARK (I also agree that comp.lang.ada is adequate for SPARK content) I have found a problem that can be shown in the following stripped-down example:

<my_package.ads>
package My_Package is

    procedure Divide (X : in Integer; Y : in Integer; Z : out Integer);
    --# derives Z from X, Y;
    --# pre Y /= 0;
    --# post Z = X / Y;

end My_Package;

<my_package.adb>
package body My_Package is

    procedure Divide (X : in Integer; Y : in Integer; Z : out Integer) is
    begin
        Z := X / Y;  -- this is line 5
    end Divide;

end My_Package;

In this example I would expect the VC associated with rtc on line 5 above to be discharged based on the hypothesis from Divide's precondition: that is, Y is known to be non-zero, so division by zero in line 5 cannot happen.

Tools are invoked in the following order:

$ sparkmake
$ spark -index_file=spark.idx -vcg -config_file=config.cfg -output_dir=spark my_package.adb
$ sparksimp
$ pogs

The summary says that the VC in question in undischarged.
Is there anything missing?

The tools come from Ubuntu packages and announce themselves as GPL 2011.

-- 
Maciej Sobczak * http://www.msobczak.com * http://www.inspirel.com



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-04-18 10:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-18  8:14 SPARK - division by zero problem Maciej Sobczak
2013-04-18  8:35 ` Phil Thornley
2013-04-18 10:28   ` Maciej Sobczak

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