diff options
author | Ed Schonberg <schonberg@adacore.com> | 2020-07-08 09:04:16 -0400 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2020-10-19 05:53:40 -0400 |
commit | 5f396397f6ed41e58f5708a645dbbb218421d4e3 (patch) | |
tree | a9d83f243f6e94e85b1db43ff5a2ddf9cbd23063 /gcc | |
parent | 44ecd94cc7daf60ed04a81107c8d52c23cfef84d (diff) | |
download | gcc-5f396397f6ed41e58f5708a645dbbb218421d4e3.zip gcc-5f396397f6ed41e58f5708a645dbbb218421d4e3.tar.gz gcc-5f396397f6ed41e58f5708a645dbbb218421d4e3.tar.bz2 |
[Ada] Compiler abort on in_out function parameter with type invariant
gcc/ada/
* exp_ch6.adb (Add_View_Conversion_Invariants): Do not insert
generated invariant checks when the call is a function call.
These tests are properly inserted in the code in procedure
Insert_Post_Call_Actions, which takes care of finding the proper
insertion point for the checks.
(Insert_Post_Call_Actions): Add question marks to indicate
possible gap in handling function calls that appear as aggregate
components.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/exp_ch6.adb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index 20506c8..aa67343 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -2943,7 +2943,12 @@ package body Exp_Ch6 is Par_Typ := Base_Type (Etype (Curr_Typ)); end loop; - if not Is_Empty_List (Inv_Checks) then + -- If the node is a function call the generated tests have been + -- already handled in Insert_Post_Call_Actions. + + if not Is_Empty_List (Inv_Checks) + and then Nkind (Call_Node) = N_Procedure_Call_Statement + then Insert_Actions_After (Call_Node, Inv_Checks); end if; end Add_View_Conversion_Invariants; @@ -8388,6 +8393,7 @@ package body Exp_Ch6 is -- The only exception is when the function call acts as an actual in a -- procedure call. In this case the function call is in a list, but the -- post-call actions must be inserted after the procedure call. + -- What if the function call is an aggregate component ??? elsif Nkind (Context) = N_Procedure_Call_Statement then Insert_Actions_After (Context, Post_Call); |