-
Notifications
You must be signed in to change notification settings - Fork 12
Declare implicit array types #335
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
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 |
|---|---|---|
|
|
@@ -59,15 +59,15 @@ Error message: Unsupported pragma: Check | |
| Nkind: N_Pragma | ||
| -- | ||
| Occurs: 8 times | ||
| Calling function: Process_Pragma_Declaration | ||
| Error message: Unsupported pragma: Obsolescent | ||
| Nkind: N_Pragma | ||
| -- | ||
| Occurs: 7 times | ||
| Calling function: Do_Type_Reference | ||
| Error message: Type of type not a type | ||
| Nkind: N_Defining_Identifier | ||
| -- | ||
| Occurs: 8 times | ||
| Calling function: Process_Pragma_Declaration | ||
| Error message: Unsupported pragma: Obsolescent | ||
| Nkind: N_Pragma | ||
| -- | ||
| Occurs: 6 times | ||
| Calling function: Process_Declaration | ||
| Error message: Use type clause declaration | ||
|
|
@@ -108,6 +108,11 @@ Calling function: Do_Itype_Definition | |
| Error message: Unknown Ekind | ||
| Nkind: N_Defining_Identifier | ||
| -- | ||
| Occurs: 2 times | ||
| Calling function: Do_Itype_Integer_Subtype | ||
| Error message: Non-literal bound unsupported | ||
| Nkind: N_Defining_Identifier | ||
| -- | ||
| Occurs: 1 times | ||
| Calling function: Do_Base_Range_Constraint | ||
| Error message: unsupported lower range kind | ||
|
|
@@ -134,11 +139,6 @@ Error message: function entity not defining identifier | |
| Nkind: N_Defining_Operator_Symbol | ||
| -- | ||
| Occurs: 1 times | ||
| Calling function: Do_Itype_Integer_Subtype | ||
|
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. Another one where we get an extra occurence |
||
| Error message: Non-literal bound unsupported | ||
| Nkind: N_Defining_Identifier | ||
| -- | ||
| Occurs: 1 times | ||
| Calling function: Do_Op_Expon | ||
| Error message: Exponentiation unhandled for non mod types at the moment | ||
| Nkind: N_Op_Expon | ||
|
|
@@ -1718,7 +1718,7 @@ Occurs: 10 times | |
| | GNU Ada (ada2goto) Assert_Failure sinfo.adb:495 | | ||
| Error detected at REDACTED | ||
| -- | ||
| Occurs: 9 times | ||
| Occurs: 8 times | ||
| +===========================GNAT BUG DETECTED==============================+ | ||
| | GNU Ada (ada2goto) Constraint_Error Symbol_Table_Info.Symbol_Maps.Constant_Reference: key not in map| | ||
| Error detected at REDACTED | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ with Range_Check; use Range_Check; | |
| with Symbol_Table_Info; use Symbol_Table_Info; | ||
| with Tree_Walk; use Tree_Walk; | ||
| with Follow; use Follow; | ||
| with Arrays; use Arrays; | ||
|
|
||
| package body Gnat2goto_Itypes is | ||
|
|
||
|
|
@@ -84,6 +85,7 @@ package body Gnat2goto_Itypes is | |
| -- might become the only way to get a type definition. | ||
| return (case Ekind (N) is | ||
| when E_Array_Subtype => Do_Itype_Array_Subtype (N), | ||
| when E_Array_Type => Do_Itype_Array_Type (N), | ||
| when E_String_Literal_Subtype => Do_Itype_String_Literal_Subtype (N), | ||
| when E_Signed_Integer_Subtype => Do_Itype_Integer_Subtype (N), | ||
| when E_Record_Subtype => Do_Itype_Record_Subtype (N), | ||
|
|
@@ -96,13 +98,36 @@ package body Gnat2goto_Itypes is | |
| "Unknown Ekind")); | ||
| end Do_Itype_Definition; | ||
|
|
||
| ---------------------------- | ||
| -- Do_Itype_Array_Type -- | ||
| ---------------------------- | ||
|
|
||
| function Do_Itype_Array_Type (E : Entity_Id) return Irep is | ||
| Var : constant Node_Id := | ||
|
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. This should get a better name than |
||
| Object_Definition (Associated_Node_For_Itype (E)); | ||
| begin | ||
| case Nkind (Var) is | ||
| when N_Constrained_Array_Definition => | ||
| return Do_Constrained_Array_Definition (Var); | ||
| when N_Unconstrained_Array_Definition => | ||
| return Do_Unconstrained_Array_Definition (Var); | ||
| when others => | ||
| return Report_Unhandled_Node_Irep | ||
| (E, "Do_Itype_Array_Type", | ||
| "Unknown array type " & Node_Kind'Image (Nkind (Var))); | ||
| end case; | ||
| end Do_Itype_Array_Type; | ||
|
|
||
| ---------------------------- | ||
| -- Do_Itype_Array_Subtype -- | ||
| ---------------------------- | ||
|
|
||
| function Do_Itype_Array_Subtype (N : Node_Id) return Irep is | ||
| (Make_Symbol_Type | ||
| (Identifier => Unique_Name (Etype (N)))); | ||
| begin | ||
| Declare_Itype (Etype (N)); | ||
| return Make_Symbol_Type | ||
| (Identifier => Unique_Name (Etype (N))); | ||
| end Do_Itype_Array_Subtype; | ||
|
|
||
| ------------------------------------- | ||
| -- Do_Itype_String_Literal_Subtype -- | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5118,6 +5118,7 @@ package body Tree_Walk is | |
| (if Ekind (E) = E_Access_Subtype then Etype (E) else E); | ||
| Type_Id : constant Symbol_Id := Intern (Type_Name); | ||
| begin | ||
| Declare_Itype (E); | ||
|
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. This is the important bit; We now just proactively declare (possible) Itypes whenever we see them ( |
||
| if Global_Symbol_Table.Contains (Type_Id) then | ||
| if Kind (Global_Symbol_Table.Element (Type_Id).SymType) in Class_Type | ||
| then | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,12 @@ | ||
| -- see also test "arrays_multidimensional_declaration_failure1" | ||
| procedure Arrays_Declaration_Failure1 is | ||
| -- ERROR, "GNAT BUG DETECTED" " GNU Ada (ada2goto) Constraint_Error Symbol_Table_Info.Symbol_Maps.Constant_Reference: key not in map|" | ||
| A1 : Array (1..3) of Integer; | ||
|
|
||
| -- ERROR, "GNAT BUG DETECTED" " GNU Ada (ada2goto) Constraint_Error Symbol_Table_Info.Symbol_Maps.Constant_Reference: key not in map|" | ||
| A2 : Array (1..3) of Integer := (1,2,3); | ||
| begin | ||
| null; | ||
| A1 (1) := 1; | ||
| pragma Assert (A1 (1) = 1); | ||
| pragma Assert (A1 (1) = 10); | ||
| pragma Assert (A2 (1) = 1); | ||
| pragma Assert (A2 (1) = 2); | ||
| end Arrays_Declaration_Failure1; |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| [precondition_instance.1] file <internal> memcpy src/dst overlap: SUCCESS | ||
| [precondition_instance.2] file <internal> memcpy source region readable: SUCCESS | ||
| [precondition_instance.3] file <internal> memcpy destination region writeable: SUCCESS | ||
| [arrays_declaration_failure1.assertion.1] line 7 Ada Check assertion: SUCCESS | ||
| [arrays_declaration_failure1.assertion.2] line 8 assertion A1 (1) = 1: SUCCESS | ||
| [arrays_declaration_failure1.assertion.3] line 9 assertion A1 (1) = 10: FAILURE | ||
| [arrays_declaration_failure1.assertion.4] line 10 assertion A2 (1) = 1: SUCCESS | ||
| [arrays_declaration_failure1.assertion.5] line 11 assertion A2 (1) = 2: FAILURE | ||
| VERIFICATION FAILED |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,8 @@ | ||
| -- see also test "arrays_multidimensional_declaration_failure2" | ||
| procedure Arrays_Declaration_Failure2 is | ||
| -- ERROR, "GNAT BUG DETECTED" "GNU Ada (ada2goto) Assert_Failure sinfo.adb:2232" | ||
| A1 : array (Integer range 1..3) of Integer; | ||
| begin | ||
| null; | ||
| A1 (1) := 10; | ||
| pragma Assert (A1 (1) = 10); | ||
| pragma Assert (A1 (1) = 20); | ||
| end Arrays_Declaration_Failure2; |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| [arrays_declaration_failure2.assertion.1] line 5 Ada Check assertion: SUCCESS | ||
| [arrays_declaration_failure2.assertion.2] line 6 assertion A1 (1) = 10: SUCCESS | ||
| [arrays_declaration_failure2.assertion.3] line 7 assertion A1 (1) = 20: FAILURE | ||
| VERIFICATION FAILED |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| ALL XFAIL gnat2goto fails with "GNU Ada (ada2goto) Constraint_Error Symbol_Table_Info.Symbol_Maps.Constant_Reference: key not in map" | ||
| ALL XFAIL GNU Ada (ada2goto) Assert_Failure failed postcondition from arrays.ads |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,25 @@ | ||
| Standard_Output from gnat2goto test: | ||
|
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. What's going on with these two tests? This looks like the tests are now producing missing feature reports which they were not before.... Were this test and procedure_pointer both passing before this change?
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. It’s basically just Itypes that we never supported, but we just “happened” to pass these tests without missing feature reports or crashes because we don’t actually use these types anywhere in the resulting goto program. I.e. as a side effect of some of the changes we’ve made in this PR some things that didn’t work before now visibly don’t work.
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. OK. There's recently been some debate on #327 about whether we should or should not add "missing feature" reports to expected outputs - I'm not sure we came to a conclusion. In this case, it's probably better to accept it in the expected output and keep the test passing, rather than turn a passing test into an xfail. |
||
| ----------At: Do_Itype_Definition---------- | ||
| ----------Unknown Ekind---------- | ||
| N_Defining_Identifier "T6b" (Entity_Id=2491) | ||
| Parent = <empty> | ||
| Sloc = 8480 test.adb:13:4 | ||
| Chars = "T6b" (Name_Id=300001463) | ||
| Next_Entity = N_Defining_Identifier "assert_compare" (Entity_Id=2476) | ||
| Scope = N_Defining_Identifier "test" (Entity_Id=2245) | ||
| Ekind = E_Access_Subtype | ||
| Etype = N_Defining_Identifier "comparator" (Entity_Id=2304) | ||
| Associated_Node_For_Itype = N_Procedure_Specification (Node_Id=2473) | ||
| Esize = 64 (Uint = 600032832) | ||
| RM_Size = 64 (Uint = 600032832) | ||
| Alignment = 4 (Uint = 600032772) | ||
| Directly_Designated_Type = N_Defining_Identifier "T3b" (Entity_Id=2451) | ||
| Can_Never_Be_Null = True | ||
| Has_Qualified_Name = True | ||
| Is_Frozen = True | ||
| Is_Internal = True | ||
| Is_Itype = True | ||
| Size_Known_At_Compile_Time = True | ||
|
|
||
| [assert_compare.assertion.1] line 15 assertion Func.all(5): FAILURE | ||
| VERIFICATION FAILED | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,26 @@ | ||
| Standard_Output from gnat2goto test: | ||
| ----------At: Do_Itype_Definition---------- | ||
| ----------Unknown Ekind---------- | ||
| N_Defining_Identifier "T4b" (Entity_Id=2491) | ||
| Parent = <empty> | ||
| Sloc = 8525 test.adb:14:4 | ||
| Chars = "T4b" (Name_Id=300001462) | ||
| Next_Entity = N_Defining_Identifier "assert_modify" (Entity_Id=2476) | ||
| Scope = N_Defining_Identifier "test" (Entity_Id=2245) | ||
| Ekind = E_Access_Subtype | ||
| Etype = N_Defining_Identifier "modifier" (Entity_Id=2315) | ||
| Associated_Node_For_Itype = N_Procedure_Specification (Node_Id=2473) | ||
| Esize = 64 (Uint = 600032832) | ||
| RM_Size = 64 (Uint = 600032832) | ||
| Alignment = 4 (Uint = 600032772) | ||
| Directly_Designated_Type = N_Defining_Identifier "T1b" (Entity_Id=2451) | ||
| Can_Never_Be_Null = True | ||
| Has_Qualified_Name = True | ||
| Is_Frozen = True | ||
| Is_Internal = True | ||
| Is_Itype = True | ||
| Size_Known_At_Compile_Time = True | ||
|
|
||
| [assert_modify.assertion.1] line 17 assertion Global_Number = 5: FAILURE | ||
| [increment_by.assertion.1] line 5 Ada Check assertion: SUCCESS | ||
| VERIFICATION FAILED |
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.
Most of the golden results changes appear to be just things moving around for some weird reason. Very few actual changes.
Uh oh!
There was an error while loading. Please reload this page.
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.
That looks like a move, but actually its because "Do_Type_Reference" went from 7 -> 8 times...
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.
@chrisr-diffblue Yes, I believe this is because some of the nodes that we now handle were not handled before. This means that some nodes in these projects now propagate, and they might result into some previously unreported errors showing up.
Uh oh!
There was an error while loading. Please reload this page.
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.
@chrisr-diffblue Keep in mind that the changes made in this PR cause gnat2goto to not crash in some circumstances where it would’ve crashed before, so it’s producing more output and potentially some additional missing but unrelated features as well.