-
Notifications
You must be signed in to change notification settings - Fork 12
Address clause #260
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
Merged
Merged
Address clause #260
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
8b87755
Handle Address representation clauses
tjj2017 1ec70ed
Add working test for using static expression to define size
tjj2017 48b6d96
Add failing test as Size representation fails when applied to
tjj2017 767ec08
Add XFAIL message for size on objects
tjj2017 37f85ad
Add test for address representation clauses
tjj2017 11cba40
Node numbers different on Linux to Mac
tjj2017 3bc748b
Updated golden-results
tjj2017 afef1d5
Rebase to current diffblue/master and update golden-results
tjj2017 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
testsuite/gnat2goto/tests/address_clause/address_clause.adb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
with System; use System; | ||
with System.Storage_Elements; | ||
procedure Address_Clause is | ||
Var_Addr_1 : Integer; | ||
for Var_Addr_1'Address use System'To_Address (16#6F#); | ||
|
||
Var_Addr_2 : Integer; | ||
for Var_Addr_2'Address use System.Storage_Elements.To_Address (16#80#); | ||
begin | ||
Var_Addr_1 := 1; | ||
Var_Addr_2 := 2; | ||
pragma Assert (Var_Addr_1 + Var_Addr_2 = 3); | ||
end Address_Clause; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Standard_Output from gnat2goto address_clause: | ||
N_Attribute_Definition_Clause "address" (Node_Id=2277) (source,analyzed) | ||
Sloc = 8303 address_clause.adb:5:4 | ||
Chars = "address" (Name_Id=300000791) | ||
Name = N_Identifier "var_addr_1" (Node_Id=2274) | ||
Expression = N_Function_Call (Node_Id=2280) | ||
Entity = N_Defining_Identifier "var_addr_1" (Entity_Id=2264) | ||
Check_Address_Alignment = True | ||
N_Attribute_Definition_Clause "address" (Node_Id=2295) (source,analyzed) | ||
Sloc = 8387 address_clause.adb:8:4 | ||
Chars = "address" (Name_Id=300000791) | ||
Name = N_Identifier "var_addr_2" (Node_Id=2292) | ||
Expression = N_Function_Call (Node_Id=2302) | ||
Entity = N_Defining_Identifier "var_addr_2" (Entity_Id=2282) | ||
Check_Address_Alignment = True | ||
|
||
Standard_Error from gnat2goto address_clause: | ||
----------At: Process_Declaration---------- | ||
----------Address representation clauses are not currently supported---------- | ||
----------At: Process_Declaration---------- | ||
----------Address representation clauses are not currently supported---------- | ||
|
||
[1] file address_clause.adb line 12 assertion: SUCCESS | ||
VERIFICATION SUCCESSFUL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from test_support import * | ||
|
||
prove() |
38 changes: 38 additions & 0 deletions
38
testsuite/gnat2goto/tests/size_integer_and_objects/check_size.adb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
procedure Check_Size is | ||
Size_1 : constant := -23 + 31; | ||
Size_2 : constant Integer := 35 - 3; | ||
Size_3 : constant := 2 * Size_1; | ||
|
||
type T_1 is new Integer range 0 .. 47; | ||
for T_1'Size use Size_1; | ||
|
||
type T_2 is range 0 .. 2**16 + 1; | ||
for T_2'Size use Size_2; | ||
|
||
type Unsigned_8 is mod 2**8; | ||
for Unsigned_8'Size use Size_3; | ||
|
||
Var_T_1 : T_1; | ||
Var_T_2 : T_2; | ||
|
||
Var_Size_1 : Integer range 0 .. 47; | ||
for Var_Size_1'Size use Size_1; | ||
|
||
Var_Size_2 : Integer range 0 .. 2**16 + 1; | ||
for Var_Size_2'Size use Size_2; | ||
|
||
Var_U8 : Unsigned_8; | ||
for Var_U8'Size use Size_1; | ||
|
||
begin | ||
Var_T_1 := 30; | ||
Var_T_2 := 40; | ||
pragma Assert (Integer (Var_T_1) + Integer (Var_T_2) = 70); | ||
|
||
Var_Size_1 := 10; | ||
Var_Size_2 := 20; | ||
pragma Assert (Var_Size_1 + Var_Size_2 = 30); | ||
|
||
Var_U8 := 255; | ||
pragma Assert (Var_U8 + 1 = 0); | ||
end Check_Size; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ALL XFAIL gnat2goto fails when Size representation clause applied to standard types and their derivations or to objects. |
19 changes: 19 additions & 0 deletions
19
testsuite/gnat2goto/tests/size_integer_and_objects/test.out
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
+===========================GNAT BUG DETECTED==============================+ | ||
| GNU Ada (ada2goto) Assert_Failure tree_walk.adb:4673 | | ||
| Error detected at check_size.adb:1:11 | | ||
| Please submit a bug report; see https://gcc.gnu.org/bugs/ . | | ||
| Use a subject line meaningful to you and us to track the bug. | | ||
| Include the entire contents of this bug box in the report. | | ||
| Include the exact command that you entered. | | ||
| Also include sources listed below. | | ||
+==========================================================================+ | ||
|
||
Please include these source files with error report | ||
Note that list may not be accurate in some cases, | ||
so please double check that the problem can still | ||
be reproduced with the set of files listed. | ||
Consider also -gnatd.n switch (see debug.adb). | ||
|
||
check_size.adb | ||
|
||
compilation abandoned |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from test_support import * | ||
|
||
prove() |
19 changes: 19 additions & 0 deletions
19
testsuite/gnat2goto/tests/size_mod_type/check_size_mod.adb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
procedure Check_Size_Mod is | ||
S1 : constant := 39 - 7; | ||
S2 : constant Integer := -100 + 164; | ||
|
||
type Unsigned_8 is mod 2 ** 8; | ||
for Unsigned_8'Size use S1; | ||
|
||
type Unsigned_4 is mod 2 ** 4; | ||
for Unsigned_4'Size use S2; | ||
|
||
V1 : Unsigned_8; | ||
V2 : Unsigned_4; | ||
begin | ||
V1 := 255; | ||
V2 := 15; | ||
|
||
pragma Assert (V1 + 1 = 0); | ||
pragma Assert (V2 + 2 = 1); | ||
end Check_Size_Mod; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[1] file check_size_mod.adb line 17 assertion: SUCCESS | ||
[2] file check_size_mod.adb line 18 assertion: SUCCESS | ||
VERIFICATION SUCCESSFUL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from test_support import * | ||
|
||
prove() |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Effectively, this line is what is changed in this commit. And it seems ok.