-
Notifications
You must be signed in to change notification settings - Fork 12
Support for function bodies #212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
ba12372
fed142b
55f62fa
1f96189
d7b5318
097c03f
687c9c8
a275d33
74bb72c
05c2419
93d71b4
6750f04
9b7e70b
c9b7583
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| [1] file absolute.adb line 7 assertion: SUCCESS | ||
| [2] file absolute.adb line 8 assertion: SUCCESS | ||
| [3] file absolute.adb line 10 assertion: FAILURE | ||
| VERIFICATION FAILED |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| from test_support import * | ||
|
|
||
| prove() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| package body Const_Decs is | ||
| procedure Inc (P : in out Integer) is | ||
| procedure Add_46 (P : in out Integer) is | ||
| begin | ||
| P := P + Read_Only_Var; | ||
| end Inc; | ||
| end Add_46; | ||
|
|
||
| end Const_Decs; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| with Const_Decs; use Const_Decs; | ||
|
|
||
| procedure Test is | ||
| My_P : Integer := 4; | ||
| begin | ||
| Add_46 (My_P); | ||
| -- Will fail: symex does not see the value | ||
| pragma Assert (My_P = 50); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With this one I'm confused. Is this supposed to happen or not? Because I'd think after
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps the name for Inc is inappropriate. The subprogram actually adds a number based on the variable Var in the constant_decs package. Using the value that Var is initialised with, Inc adds 46 to its parameter. I think a more usual scenario that I think we should test is when a private type and deferred constant is used (as in the test below.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Renamed to |
||
| end Test; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| VERIFICATION SUCCESSFUL | ||
| [1] file test.adb line 8 assertion: FAILURE | ||
| VERIFICATION FAILED |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| with Deferred_Const; use Deferred_Const; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure what this test is checking. Originally I provide a test program called use_deferred_const If we add another priv constant to the package Deferred_Const as below: Then in Use_Deferred_Constant after the call to Inc we could place the Which should succeed.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I haven't added the test, I just wanted it to reach symex. This way the the range-check for |
||
|
|
||
| procedure Test is | ||
| My_P : Integer := 4; | ||
| begin | ||
| pragma Assert (My_P = 4); | ||
| end Test; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| [assertion.1] Range Check: SUCCESS | ||
| [1] file test.adb line 6 assertion: SUCCESS | ||
| VERIFICATION SUCCESSFUL |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| package body Incomplete_Dec is | ||
| procedure P (X : in out Partial_Dec) is | ||
| procedure Inc (X : in out Partial_Dec) is | ||
| begin | ||
| X.A := X.A + 1; | ||
| end P; | ||
| end Inc; | ||
| end Incomplete_Dec; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| with Incomplete_Dec; use Incomplete_Dec; | ||
|
|
||
| procedure Test is | ||
| My_Rec : Partial_Dec := (A=>1); | ||
| begin | ||
| Inc (My_Rec); | ||
| pragma Assert (My_Rec.A = 2); | ||
| end Test; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| [1] file test.adb line 7 assertion: SUCCESS | ||
| VERIFICATION SUCCESSFUL |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| with Incomplete_Dec_Priv; use Incomplete_Dec_Priv; | ||
|
|
||
| procedure Test is | ||
| My_Int : Integer := 4; | ||
| begin | ||
| Q(My_Int); | ||
| pragma Assert (My_Int = 5); | ||
| end Test; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| [1] file test.adb line 7 assertion: SUCCESS | ||
| VERIFICATION SUCCESSFUL |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| [1] file op_and_example.adb line 11 assertion: SUCCESS | ||
| [2] file op_and_example.adb line 15 assertion: SUCCESS | ||
| [3] file op_and_example.adb line 16 assertion: FAILURE | ||
| VERIFICATION FAILED |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| from test_support import * | ||
|
|
||
| prove() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| [1] file op_or_example.adb line 11 assertion: SUCCESS | ||
| [2] file op_or_example.adb line 15 assertion: SUCCESS | ||
| [3] file op_or_example.adb line 16 assertion: FAILURE | ||
| VERIFICATION FAILED |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| from test_support import * | ||
|
|
||
| prove() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,3 @@ | ||
| VERIFICATION SUCCESSFUL | ||
| Error from cbmc use_type_clause: | ||
| **** WARNING: no body for function count_types__double | ||
|
|
||
| [1] file use_type_clause.adb line 21 assertion: SUCCESS | ||
| [2] file use_type_clause.adb line 24 assertion: FAILURE | ||
| VERIFICATION FAILED | ||
| [2] file use_type_clause.adb line 24 assertion: SUCCESS | ||
| VERIFICATION SUCCESSFUL |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| with Private_Dec; use Private_Dec; | ||
|
|
||
| procedure Test is | ||
| My_Int : Integer := 4; | ||
| begin | ||
| Q(My_Int); | ||
| pragma Assert (My_Int = 5); | ||
| end Test; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| [1] file test.adb line 7 assertion: SUCCESS | ||
| VERIFICATION SUCCESSFUL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug output (I'm guessing this'll go away once the draft phase is done)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not add it, but I can remove it. Done.