This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Test for common parent before testing for sibling


Splice_Subtree specifies a position in the target container to which the source
subtree should be moved. The target position is a 2-tuple comprising the new
parent of the subtree and its new (next) sibling (parameter Before).

Before attempting to move the subtree, the implementation must perform two
tests. If the Subtree node is the same as the Before node, then the operation
does nothing. If the Subtree node's next sibling is the same as Before, then
there is nothing else to do. If neither of these conditions hold, then the
subtree is moved from the source to the target.

However, these tests are only appropriate if the Subtree node and the Before
node have the same parent. The bug was that the sibling tests were performed
without also testing the parent. The fix is to test the sibling only after also
testing the parent.

There is one additional change for the bounded from of the tree
container. Instead of moving the subtree (which does not make sense for a
bounded form), that container first copies the subtree from the source to the
target, and then deletes the subtree from the source. There was a bug in which
only the children of the source subtree were deleted from the source (the root
node of the subtree was not deleted). The fix is to remove all of the subtree
node and its children from the source tree.

Tested on x86_64-pc-linux-gnu, committed on trunk

2011-08-29  Matthew Heaney  <heaney@adacore.com>

	* a-comutr.adb, a-cimutr.adb, a-cbmutr.adb (Splice_Subtree): Only check
	for sibling when common parent.

Attachment: difs
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]