Fix a possible infinite loop in ctf_discard().
MFC r279864:
Use CTF_TYPE_TO_INDEX when comparing type indices to the dynamic type
threshold.
MFC r279869:
If the destination container contains only a forward declaration for the
input type in ctf_add_type(), search its dynamic type list before adding
a new type.