* [COMMITTED] ada: Fix predicate check failure in Expand_Allocator_Expression
@ 2023-11-30 10:19 Marc Poulhiès
0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2023-11-30 10:19 UTC (permalink / raw)
To: gcc-patches; +Cc: Eric Botcazou
From: Eric Botcazou <ebotcazou@adacore.com>
The For_Special_Return_Object flag needs to be accessed on entry of the
procedure in case the allocator is rewritten during the processing.
gcc/ada/
* exp_ch4.adb (Expand_Allocator_Expression): Add Special_Return
boolean constant to hold the value of For_Special_Return_Object
for the allocator and use it throughout the procedure.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/exp_ch4.adb | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index f04ac615be9..e708ed350d1 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -555,15 +555,16 @@ package body Exp_Ch4 is
---------------------------------
procedure Expand_Allocator_Expression (N : Node_Id) is
- Loc : constant Source_Ptr := Sloc (N);
- Exp : constant Node_Id := Expression (Expression (N));
- PtrT : constant Entity_Id := Etype (N);
- DesigT : constant Entity_Id := Designated_Type (PtrT);
+ Loc : constant Source_Ptr := Sloc (N);
+ Exp : constant Node_Id := Expression (Expression (N));
+ Indic : constant Node_Id := Subtype_Mark (Expression (N));
+ T : constant Entity_Id := Entity (Indic);
+ PtrT : constant Entity_Id := Etype (N);
+ DesigT : constant Entity_Id := Designated_Type (PtrT);
+ Special_Return : constant Boolean := For_Special_Return_Object (N);
-- Local variables
- Indic : constant Node_Id := Subtype_Mark (Expression (N));
- T : constant Entity_Id := Entity (Indic);
Adj_Call : Node_Id;
Aggr_In_Place : Boolean;
Node : Node_Id;
@@ -902,7 +903,7 @@ package body Exp_Ch4 is
-- Likewise if the allocator is made for a special return object
- elsif For_Special_Return_Object (N) then
+ elsif Special_Return then
null;
elsif Is_Tagged_Type (T) and then not Is_Class_Wide_Type (T) then
@@ -944,7 +945,7 @@ package body Exp_Ch4 is
and then not Is_Inherently_Limited_Type (T)
and then not Aggr_In_Place
and then Nkind (Exp) /= N_Function_Call
- and then not For_Special_Return_Object (N)
+ and then not Special_Return
then
-- An unchecked conversion is needed in the classwide case because
-- the designated type can be an ancestor of the subtype mark of
--
2.42.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-11-30 10:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-30 10:19 [COMMITTED] ada: Fix predicate check failure in Expand_Allocator_Expression Marc Poulhiès
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).