aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2024-12-10 17:53:34 +0100
committerMarc Poulhiès <dkm@gcc.gnu.org>2025-01-06 10:14:47 +0100
commit145314b3ef9017bb7d841578bb989dd85b3a12ac (patch)
tree2a93bf5724988389e1db5c1f02dd62ea3f4aca69 /gcc
parentd47596b4bb71179edbd1811aa0ddffda903c08c3 (diff)
downloadgcc-145314b3ef9017bb7d841578bb989dd85b3a12ac.zip
gcc-145314b3ef9017bb7d841578bb989dd85b3a12ac.tar.gz
gcc-145314b3ef9017bb7d841578bb989dd85b3a12ac.tar.bz2
ada: Plug small loophole in previous change
The initial change only deals with the controlled record case for assignment statements, but the controlled array case needs the same treatment. gcc/ada/ChangeLog: * exp_ch5.adb (Expand_Assign_Array): Bail out for controlled components if the RHS is a function call and the assignment has the No_Ctrl_Actions flag set.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/exp_ch5.adb7
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/ada/exp_ch5.adb b/gcc/ada/exp_ch5.adb
index 39b26e0..096509b 100644
--- a/gcc/ada/exp_ch5.adb
+++ b/gcc/ada/exp_ch5.adb
@@ -534,9 +534,14 @@ package body Exp_Ch5 is
Loop_Required := True;
-- Arrays with controlled components are expanded into a loop to force
- -- calls to Adjust at the component level.
+ -- calls to Adjust at the component level, except for a function call
+ -- that requires no controlling actions (see Expand_Ctrl_Function_Call).
elsif Has_Controlled_Component (L_Type) then
+ if Nkind (Rhs) = N_Function_Call and then No_Ctrl_Actions (N) then
+ return;
+ end if;
+
Loop_Required := True;
-- If object is full access, we cannot tolerate a loop