diff options
author | Hristian Kirtchev <kirtchev@adacore.com> | 2019-07-05 07:03:15 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2019-07-05 07:03:15 +0000 |
commit | 9880061b346330e7c986016bdec75f38659f8793 (patch) | |
tree | b1d51f2c7107ba6b077bb2d6db13ef83c56c8568 /gcc/ada | |
parent | d90eeca129a12d2236f8625d8ea5c93826bb526f (diff) | |
download | gcc-9880061b346330e7c986016bdec75f38659f8793.zip gcc-9880061b346330e7c986016bdec75f38659f8793.tar.gz gcc-9880061b346330e7c986016bdec75f38659f8793.tar.bz2 |
[Ada] Crash on deallocating component with discriminated task
This patch modifies the generation of task deallocation code to examine
the underlying type for task components.
2019-07-05 Hristian Kirtchev <kirtchev@adacore.com>
gcc/ada/
* exp_ch7.adb (Cleanup_Record): Use the underlying type when
checking for components with tasks.
gcc/testsuite/
* gnat.dg/task3.adb, gnat.dg/task3.ads, gnat.dg/task3_pkg1.ads,
gnat.dg/task3_pkg2.ads: New testcase.
From-SVN: r273121
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ada/exp_ch7.adb | 11 |
2 files changed, 11 insertions, 5 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index fed5a15..6da90f2 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2019-07-05 Hristian Kirtchev <kirtchev@adacore.com> + + * exp_ch7.adb (Cleanup_Record): Use the underlying type when + checking for components with tasks. + 2019-07-05 Arnaud Charlet <charlet@adacore.com> * libgnarl/s-osinte__linux.ads: Link with -lrt before -lpthread. diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb index 1e17b19..4526af6 100644 --- a/gcc/ada/exp_ch7.adb +++ b/gcc/ada/exp_ch7.adb @@ -3893,11 +3893,12 @@ package body Exp_Ch7 is Typ : Entity_Id) return List_Id is Loc : constant Source_Ptr := Sloc (N); - Tsk : Node_Id; - Comp : Entity_Id; Stmts : constant List_Id := New_List; U_Typ : constant Entity_Id := Underlying_Type (Typ); + Comp : Entity_Id; + Tsk : Node_Id; + begin if Has_Discriminants (U_Typ) and then Nkind (Parent (U_Typ)) = N_Full_Type_Declaration @@ -3918,7 +3919,7 @@ package body Exp_Ch7 is return New_List (Make_Null_Statement (Loc)); end if; - Comp := First_Component (Typ); + Comp := First_Component (U_Typ); while Present (Comp) loop if Has_Task (Etype (Comp)) or else Has_Simple_Protected_Object (Etype (Comp)) @@ -3937,8 +3938,8 @@ package body Exp_Ch7 is elsif Is_Record_Type (Etype (Comp)) then - -- Recurse, by generating the prefix of the argument to - -- the eventual cleanup call. + -- Recurse, by generating the prefix of the argument to the + -- eventual cleanup call. Append_List_To (Stmts, Cleanup_Record (N, Tsk, Etype (Comp))); |