-d treecheck fails to detect multiple pointers to same son
|
|
Bugzilla Link |
713 |
Created on |
May 24, 2010 13:48 |
Resolution |
FIXED |
Resolved on |
Jun 08, 2010 15:10 |
Version |
svn |
OS |
Linux |
Architecture |
PC |
Extended Description
I have been scratching my head, and possibly other places, for
several days chasing a crash in FREElet(), which turned out to
be, I believe, a failure of -d treecheck to detect the case
when more than one node points to the same son node.
In my case on my local code, I ran into the problem when generator nodes
became N_array nodes. Although the generated IL LOOKS ok,
it is definitely damaged, because when either node tree
is freed, it takes the (illegally shared) son with it.
I think a fix might work along these lines, in check.c and
friends:
- introduce a HasParent flag in the common part of each node.
I don't know, offhand, where that part is defined, but I
suppose a grep of NODE_TYPE would be a good start.
- anonymous traversal over ALL nodes, at the front end of CHK,
that does:
HasParent(node) = FALSE;
- the regular CHK traversal following would then do:
complain if HasParent(son).
HasParent( son) = TRUE;
How do I code an anonymous traversal over all nodes?
I thought, based on conversations in the dim past, that this was supposed
to work already, but apparently, that is not the case.