From patchwork Mon Aug 29 14:21:49 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 112066 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 100DFB6F99 for ; Tue, 30 Aug 2011 00:22:07 +1000 (EST) Received: (qmail 13411 invoked by alias); 29 Aug 2011 14:22:05 -0000 Received: (qmail 13394 invoked by uid 22791); 29 Aug 2011 14:22:03 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 29 Aug 2011 14:21:50 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 963E92BB00E; Mon, 29 Aug 2011 10:21:49 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id xdWFUoNZ+Cq3; Mon, 29 Aug 2011 10:21:49 -0400 (EDT) Received: from kwai.gnat.com (kwai.gnat.com [205.232.38.4]) by rock.gnat.com (Postfix) with ESMTP id 837D12BAEFE; Mon, 29 Aug 2011 10:21:49 -0400 (EDT) Received: by kwai.gnat.com (Postfix, from userid 4192) id 7937792A55; Mon, 29 Aug 2011 10:21:49 -0400 (EDT) Date: Mon, 29 Aug 2011 10:21:49 -0400 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Matthew Heaney Subject: [Ada] Move must clear Source following assignment to Target Message-ID: <20110829142149.GA29860@adacore.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org The semantics of operation Move for the bounded forms must match the semantics of the unbounded forms. The post-condition is defined (for all containers) such that when Move completes, the Source container is empty. The fix is to clear the Source container after its elements have been assigned to Target. Tested on x86_64-pc-linux-gnu, committed on trunk 2011-08-29 Matthew Heaney * a-cbhama.ads, a-cbhase.ads (Move): Clear Source following assignment to Target. Index: a-cbhama.adb =================================================================== --- a-cbhama.adb (revision 178242) +++ a-cbhama.adb (working copy) @@ -728,7 +728,8 @@ "attempt to tamper with cursors (container is busy)"; end if; - Assign (Target => Target, Source => Source); + Target.Assign (Source); + Source.Clear; end Move; ---------- Index: a-cbhase.adb =================================================================== --- a-cbhase.adb (revision 178155) +++ a-cbhase.adb (working copy) @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2004-2010, Free Software Foundation, Inc. -- +-- Copyright (C) 2004-2011, 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- -- @@ -925,7 +925,8 @@ "attempt to tamper with cursors (container is busy)"; end if; - Assign (Target => Target, Source => Source); + Target.Assign (Source); + Source.Clear; end Move; ----------