The purpose of the Merge operation is to move elements from
a sorted vector (the source) to another sorted vector (the target).
Following the merge, the source container should be empty. There
was an execution path (when the target was initially empty) in which
the elements of the source were merely copied onto the target,
without also removing the elements from the source. The fix was
to use the Move operation, instead of Assign, when merging elements
from source onto an emtpy target.
Tested on x86_64-pc-linux-gnu, committed on trunk
2011-08-03 Matthew Heaney <[email protected]>
* a-cobove.adb (Merge): Move source onto target, instead of using Assign
Index: a-cobove.adb
===================================================================
--- a-cobove.adb (revision 176998)
+++ a-cobove.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- --
@@ -762,7 +762,7 @@
begin
if Target.Is_Empty then
- Target.Assign (Source);
+ Move (Target => Target, Source => Source);
return;
end if;