I'm doing a code review fixing up some things while I'm going. Code in the intricate core parts will be untouched until discussed here though.
On line 340 of rbtree.c we belive that granparent might be 0, but a few lines down it's dereferenced as if that was not an option. Either the first if in assignment of top is unneeded and should go, or things will blow up.
If PIKE_DEBUG is set it will fatal on grandparenslessness, but that also makes the top assignment above it useless.