From: Brad Moore <bmoore.ada@gmail.com>
Subject: Re: GNAT proposal: note on implicit exceptions insertion
Date: Fri, 15 Feb 2019 20:30:13 -0800 (PST)
Date: 2019-02-15T20:30:13-08:00 [thread overview]
Message-ID: <6225c504-8085-4753-bedd-0b1e5816d2a0@googlegroups.com> (raw)
In-Reply-To: <989ea6c7-b432-4214-beec-c0a50b76932c@googlegroups.com>
One option would be to write the code you want checked in SPARK.
For example, from your example above, one could write....
package P with SPARK_Mode is
subtype Index_Type is Integer range 1 .. 100;
My_Array : array (Index_Type) of Boolean;
procedure Foo (Index : Integer);
end P;
package body P with SPARK_Mode is
procedure Foo (Index : Integer) is
begin
My_Array (Index) := True; -- SPARK detects exception may be raised here
end Foo;
end P;
The code compiles in Ada, but the SPARK prover complains....
Phase 1 of 2: generation of Global contracts ...
Phase 2 of 2: flow analysis and proof ...
p.adb:6:17: medium: array index check might fail (e.g. when Index = 0)
Brad
next prev parent reply other threads:[~2019-02-16 4:30 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-10 2:03 GNAT proposal: note on implicit exceptions insertion Jesper Quorning
2019-02-10 18:08 ` Simon Wright
2019-02-11 21:36 ` Jesper Quorning
2019-02-11 22:31 ` Anh Vo
2019-02-11 23:41 ` Randy Brukardt
2019-02-12 7:05 ` Jesper Quorning
2019-02-12 23:08 ` Randy Brukardt
2019-02-16 4:30 ` Brad Moore [this message]
2019-02-16 16:15 ` Jesper Quorning
2019-02-12 8:19 ` Dmitry A. Kazakov
2019-02-12 8:35 ` Jesper Quorning
2019-02-12 9:20 ` Dmitry A. Kazakov
2019-02-12 12:46 ` Jesper Quorning
2019-02-12 7:28 ` Mark Lorenzen
2019-02-12 8:34 ` Jesper Quorning
2019-02-12 22:31 ` Fedja Beader
2019-02-13 10:42 ` Simon Wright
2019-02-11 6:53 ` Mark Lorenzen
2019-02-11 8:13 ` Simon Wright
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox