diff options
author | Hristian Kirtchev <kirtchev@adacore.com> | 2018-12-11 11:10:42 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2018-12-11 11:10:42 +0000 |
commit | e2819941fc6eb15c3955d75e45f30dedb3713389 (patch) | |
tree | 3ee029cb67dc295c3463f544a96950117e7a3367 /gcc/ada/exp_util.ads | |
parent | 30a5fd0b463897d12a9f4e3e27a15b3146a52b3d (diff) | |
download | gcc-e2819941fc6eb15c3955d75e45f30dedb3713389.zip gcc-e2819941fc6eb15c3955d75e45f30dedb3713389.tar.gz gcc-e2819941fc6eb15c3955d75e45f30dedb3713389.tar.bz2 |
[Ada] Crash on ignored Ghost expression function
This patch updates freezing to ensure that freeze nodes are inserted
into the tree when the entity being frozen is non-Ghost, and the context
is an ignored Ghost spec expression.
2018-12-11 Hristian Kirtchev <kirtchev@adacore.com>
gcc/ada/
* exp_util.adb (Insert_Action): Add new formal parameter
Spec_Expr_OK.
(Insert_Actions): Add new formal parameter Spec_Expr_OK. Update
all calls to Insert_Actions where relevant. Honour an insertion
from a spec expression context when requested by the caller.
* exp_util.ads (Insert_Action): Add new formal parameter
Spec_Expr_OK.
(Insert_Actions): Add new formal parameter Spec_Expr_OK.
* freeze.adb (Add_To_Result): Force the insertion of the freeze
node even when the context is a spec expression.
gcc/testsuite/
* gnat.dg/ghost2.adb, gnat.dg/ghost2.ads: New testcase.
From-SVN: r266996
Diffstat (limited to 'gcc/ada/exp_util.ads')
-rw-r--r-- | gcc/ada/exp_util.ads | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/gcc/ada/exp_util.ads b/gcc/ada/exp_util.ads index ab48b74..97eccdd 100644 --- a/gcc/ada/exp_util.ads +++ b/gcc/ada/exp_util.ads @@ -89,39 +89,54 @@ package Exp_Util is -- calls, and this guarantee is preserved for the special cases above. procedure Insert_Action - (Assoc_Node : Node_Id; - Ins_Action : Node_Id); + (Assoc_Node : Node_Id; + Ins_Action : Node_Id; + Spec_Expr_OK : Boolean := False); -- Insert the action Ins_Action at the appropriate point as described -- above. The action is analyzed using the default checks after it is -- inserted. Assoc_Node is the node with which the action is associated. + -- When flag Spec_Expr_OK is set, insertions triggered in the context of + -- spec expressions are honoured, even though they contradict "Handling + -- of Default and Per-Object Expressions". procedure Insert_Action - (Assoc_Node : Node_Id; - Ins_Action : Node_Id; - Suppress : Check_Id); + (Assoc_Node : Node_Id; + Ins_Action : Node_Id; + Suppress : Check_Id; + Spec_Expr_OK : Boolean := False); -- Insert the action Ins_Action at the appropriate point as described -- above. The action is analyzed using the default checks as modified -- by the given Suppress argument after it is inserted. Assoc_Node is - -- the node with which the action is associated. + -- the node with which the action is associated. When flag Spec_Expr_OK + -- is set, insertions triggered in the context of spec expressions are + -- honoured, even though they contradict "Handling of Default and Per- + -- Object Expressions". procedure Insert_Actions - (Assoc_Node : Node_Id; - Ins_Actions : List_Id); + (Assoc_Node : Node_Id; + Ins_Actions : List_Id; + Spec_Expr_OK : Boolean := False); -- Insert the list of action Ins_Actions at the appropriate point as -- described above. The actions are analyzed using the default checks -- after they are inserted. Assoc_Node is the node with which the actions -- are associated. Ins_Actions may be No_List, in which case the call has - -- no effect. + -- no effect. When flag Spec_Expr_OK is set, insertions triggered in the + -- context of spec expressions are honoured, even though they contradict + -- "Handling of Default and Per-Object Expressions". procedure Insert_Actions - (Assoc_Node : Node_Id; - Ins_Actions : List_Id; - Suppress : Check_Id); + (Assoc_Node : Node_Id; + Ins_Actions : List_Id; + Suppress : Check_Id; + Spec_Expr_OK : Boolean := False); -- Insert the list of action Ins_Actions at the appropriate point as -- described above. The actions are analyzed using the default checks -- as modified by the given Suppress argument after they are inserted. - -- Assoc_Node is the node with which the actions are associated. + -- Assoc_Node is the node with which the actions are associated. List -- Ins_Actions may be No_List, in which case the call has no effect. + -- When flag Spec_Expr_OK is set, insertions triggered in the context of + -- spec expressions are honoured, even though they contradict "Handling + -- of Default and Per-Object Expressions". procedure Insert_Action_After (Assoc_Node : Node_Id; |