diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-10-17 14:07:57 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-10-17 14:07:57 +0000 |
commit | f89806a34a24243777a5a88d3002eda52ee687af (patch) | |
tree | b86dd1066e33deeb638fb8adb817f1b91b7ee3bd /gcc/ada/g-arrspl.adb | |
parent | 9dd93ed9d6883b9f7ef721bdf0d730eafbc2eed3 (diff) | |
download | ppe42-gcc-f89806a34a24243777a5a88d3002eda52ee687af.tar.gz ppe42-gcc-f89806a34a24243777a5a88d3002eda52ee687af.zip |
2013-10-17 Yannick Moy <moy@adacore.com>
* sem_res.adb (Resolve_Short_Circuit): Only
generate expression-with-action when full expansion is set.
2013-10-17 Yannick Moy <moy@adacore.com>
* debug.adb Remove obsolete comment.
2013-10-17 Thomas Quinot <quinot@adacore.com>
* exp_ch4.adb (Process_Transient_Object.Find_Enclosing_Contexts):
Avoid late insertion when expanding an expression with action
nested within a transient block; Do not inconditionally generate
a finalization call if the generated object is from a specific
branch of a conditional expression.
2013-10-17 Pascal Obry <obry@adacore.com>
* g-arrspl.adb: Ensure Finalize call is idempotent.
* g-arrspl.adb (Finalize): Makes the call idempotent.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@203768 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/g-arrspl.adb')
-rw-r--r-- | gcc/ada/g-arrspl.adb | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/gcc/ada/g-arrspl.adb b/gcc/ada/g-arrspl.adb index a897b13f913..9229610554f 100644 --- a/gcc/ada/g-arrspl.adb +++ b/gcc/ada/g-arrspl.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2002-2009, Free Software Foundation, Inc. -- +-- Copyright (C) 2002-2013, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -118,14 +118,22 @@ package body GNAT.Array_Split is procedure Free is new Ada.Unchecked_Deallocation (Natural, Counter); + Ref_Counter : Counter := S.Ref_Counter; + begin - S.Ref_Counter.all := S.Ref_Counter.all - 1; + -- Ensure call is idempotent + + S.Ref_Counter := null; - if S.Ref_Counter.all = 0 then - Free (S.Source); - Free (S.Indexes); - Free (S.Slices); - Free (S.Ref_Counter); + if Ref_Counter /= null then + Ref_Counter.all := Ref_Counter.all - 1; + + if Ref_Counter.all = 0 then + Free (S.Source); + Free (S.Indexes); + Free (S.Slices); + Free (Ref_Counter); + end if; end if; end Finalize; |