ast: Prevent seg fault if identical labels are purged

A problem found by Demitri Muna