[Ada] Incorrect assignment when deleting node
Arnaud Charlet
charlet@adacore.com
Mon Aug 1 09:16:00 GMT 2011
When a node was being removed from the tree, the node itself was
being assigned to the child of its parent, which was incorrect.
The correct assignment value is the left child of the deleted node.
Tested on x86_64-pc-linux-gnu, committed on trunk
2011-08-01 Matthew Heaney <heaney@adacore.com>
* a-rbtgbo.adb (Delete_Node_Sans_Free): Fixed assignment to left child
of node.
-------------- next part --------------
Index: a-rbtgbo.adb
===================================================================
--- a-rbtgbo.adb (revision 176998)
+++ a-rbtgbo.adb (working copy)
@@ -330,7 +330,7 @@
Set_Right (N (Parent (N (Z))), Y);
end if;
- Set_Left (N (Y), Z);
+ Set_Left (N (Y), Left (N (Z)));
Set_Parent (N (Left (N (Y))), Y);
Set_Right (N (Y), Z);
Set_Parent (N (Z), Y);
More information about the Gcc-patches
mailing list