summaryrefslogtreecommitdiff
path: root/gcc/ada/s-tassta.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2011-09-06 10:35:25 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2011-09-06 10:35:25 +0000
commita3a76ccc41dd9d4d6e05bdcc53a81cc9c98d6ccc (patch)
treeb09f42a49b595c51ca661f47a4e6113ec4d568de /gcc/ada/s-tassta.adb
parent0fff5aefd695d45fe057d4ec877f78f5f55f242c (diff)
downloadgcc-a3a76ccc41dd9d4d6e05bdcc53a81cc9c98d6ccc.tar.gz
2011-09-06 Ed Schonberg <schonberg@adacore.com>
* exp_ch6.adb (Expand_Inlined_Call): Fix use of uninitialized variable for type of return value when return type is unconstrained and context is an assignment. 2011-09-06 Ed Schonberg <schonberg@adacore.com> * sem_ch8.adb (Check_Class_Wide_Actual): Do not generate body of class-wide operation if expansion is not enabled. 2011-09-06 Eric Botcazou <ebotcazou@adacore.com> * checks.adb (Apply_Scalar_Range_Check): Deal with access type prefix. 2011-09-06 Yannick Moy <moy@adacore.com> * sem_ch13.adb (Analyze_Aspect_Specifications, case Aspect_Invariant): Do not issue error at this point on illegal pragma placement, as this is checked later on when analyzing the corresponding pragma. * sem_prag.adb (Error_Pragma_Arg_Alternate_Name): New procedure similar to Error_Pragma_Arg, except the source name of the aspect/pragma to use in warnings may be equal to parameter Alt_Name (Analyze_Pragma, case Pragma_Invariant): refine error message to distinguish source name of pragma/aspect, and whether the illegality resides in the type being public, or being private without a public declaration 2011-09-06 Thomas Quinot <quinot@adacore.com> * g-socket.adb (Check_For_Fd_Set): On Windows, no need for bitmap size check (fd_set is implemented differently on that platform). 2011-09-06 Thomas Quinot <quinot@adacore.com> * s-taprop-vxworks.adb, s-taprop-tru64.adb, s-taprop-vms.adb, s-tpoaal.adb, s-taprop-mingw.adb, s-taprop-linux.adb, s-taprop-solaris.adb, s-taprop-irix.adb, s-taprop.ads, s-taprop-hpux-dce.adb, s-taprop-dummy.adb, s-taprop-posix.adb (ATCB_Allocation): New subpackage of System.Tasking.Primitive_Operations, shared across all targets with full tasking runtime. (ATCB_Allocation.New_ATCB): Moved there (from target specific s-taprop bodies). (ATCB_Allocation.Free_ATCB): New subprogram. Deallocate an ATCB, taking care of establishing a local temporary ATCB if the one being deallocated is Self, to avoid a reference to the freed ATCB in Abort_Undefer. 2011-09-06 Thomas Quinot <quinot@adacore.com> * s-tassta.adb, s-taskin.ads (Free_Task): If the task is not terminated, mark it for deallocation upon termination. (Terminate_Task): Call Free_Task again if the task is marked for automatic deallocation upon termination. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@178582 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/s-tassta.adb')
-rw-r--r--gcc/ada/s-tassta.adb18
1 files changed, 12 insertions, 6 deletions
diff --git a/gcc/ada/s-tassta.adb b/gcc/ada/s-tassta.adb
index bf1cc3570f8..6449bf6b017 100644
--- a/gcc/ada/s-tassta.adb
+++ b/gcc/ada/s-tassta.adb
@@ -969,12 +969,11 @@ package body System.Tasking.Stages is
Free_Entry_Names (T);
System.Task_Primitives.Operations.Finalize_TCB (T);
- -- If the task is not terminated, then we simply ignore the call. This
- -- happens when a user program attempts an unchecked deallocation on
- -- a non-terminated task.
-
else
- null;
+ -- If the task is not terminated, then mark the task as to be freed
+ -- upon termination.
+
+ T.Free_On_Termination := True;
end if;
end Free_Task;
@@ -1429,6 +1428,7 @@ package body System.Tasking.Stages is
procedure Terminate_Task (Self_ID : Task_Id) is
Environment_Task : constant Task_Id := STPO.Environment_Task;
Master_of_Task : Integer;
+ Deallocate : Boolean;
begin
Debug.Task_Termination_Hook;
@@ -1474,6 +1474,7 @@ package body System.Tasking.Stages is
Stack_Guard (Self_ID, False);
Utilities.Make_Passive (Self_ID, Task_Completed => True);
+ Deallocate := Self_ID.Free_On_Termination;
if Single_Lock then
Unlock_RTS;
@@ -1485,7 +1486,12 @@ package body System.Tasking.Stages is
Initialization.Final_Task_Unlock (Self_ID);
-- WARNING: past this point, this thread must assume that the ATCB has
- -- been deallocated. It should not be accessed again.
+ -- been deallocated, and can't access it anymore (which is why we have
+ -- saved the Free_On_Termination flag in a temporary variable).
+
+ if Deallocate then
+ Free_Task (Self_ID);
+ end if;
if Master_of_Task > 0 then
STPO.Exit_Task;