When a task was stored in a record, GNAT would mistakenly generate a
call to free_task twice, the first being correct and triggered by the
freeing of the record, the second being incorrect and generated from
recursing through the record's _parent.
Tested on x86_64-pc-linux-gnu, committed on trunk
gcc/ada/
* exp_ch7.adb (Cleanup_Record): Don't process parent.
diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb
--- a/gcc/ada/exp_ch7.adb
+++ b/gcc/ada/exp_ch7.adb
@@ -4629,8 +4629,9 @@ package body Exp_Ch7 is
Comp := First_Component (U_Typ);
while Present (Comp) loop
- if Has_Task (Etype (Comp))
- or else Has_Simple_Protected_Object (Etype (Comp))
+ if Chars (Comp) /= Name_uParent
+ and then (Has_Task (Etype (Comp))
+ or else Has_Simple_Protected_Object (Etype (Comp)))
then
Tsk :=
Make_Selected_Component (Loc,