Bug in tsi_link_before/after or wrong comment?
Mostafa Hagog
MUSTAFA@il.ibm.com
Wed Jun 16 08:41:00 GMT 2004
tsi_link_before/after in tree-iterator.c has the following problem:
tree-iterator.h says:
TSI_NEW_STMT, /* Leave the iterator at the same statement. */
TSI_SAME_STMT, /* Only valid when single statement is added, move
iterator to it. */
And in tree-iterator.c "tsi_link_before" does the following:
/* Update the iterator, if requested. */
switch (mode)
{
case TSI_NEW_STMT: <===========
case TSI_CONTINUE_LINKING:
case TSI_CHAIN_START:
i->ptr = head;
break;
case TSI_CHAIN_END:
i->ptr = tail;
break;
case TSI_SAME_STMT: <=========
if (!cur)
abort ();
break;
}
The marked two lines above does the opposite from what written
in the comment in tree-iterator.h. The same problem exists in
tsi_link_after.
One of two solutions is required: 1. change tsi_link_before/after or, 2.
change the comment.
Since I usually rely on comment I prefer the first solution? any other
suggestions ?
More information about the Gcc
mailing list