aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/exp_ch7.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/exp_ch7.adb')
-rw-r--r--gcc/ada/exp_ch7.adb12
1 files changed, 8 insertions, 4 deletions
diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb
index 9be3a18..6483c7e 100644
--- a/gcc/ada/exp_ch7.adb
+++ b/gcc/ada/exp_ch7.adb
@@ -4369,12 +4369,16 @@ package body Exp_Ch7 is
function Requires_Hooking return Boolean is
begin
-- The context is either a procedure or function call or an object
- -- declaration initialized by a function call. In all these cases,
- -- the calls might raise an exception.
+ -- declaration initialized by a function call. Note that in the
+ -- latter case, a function call that returns on the secondary
+ -- stack is usually rewritten into something else. Its proper
+ -- detection requires examination of the original initialization
+ -- expression.
return Nkind (N) in N_Subprogram_Call
- or else (Nkind (N) = N_Object_Declaration
- and then Nkind (Expression (N)) = N_Function_Call);
+ or else (Nkind (N) = N_Object_Declaration
+ and then Nkind (Original_Node (Expression (N))) =
+ N_Function_Call);
end Requires_Hooking;
-- Local variables