Patchwork [Ada] Incorrect assignment when deleting node

mail settings
Submitter Arnaud Charlet
Date Aug. 1, 2011, 9:16 a.m.
Message ID <>
Download mbox | patch
Permalink /patch/107697/
State New
Headers show


Arnaud Charlet - Aug. 1, 2011, 9:16 a.m.
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  <>

	* a-rbtgbo.adb (Delete_Node_Sans_Free): Fixed assignment to left child
	of node.


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);