Actually the intersection algorithm works only with two segments, but a single segment can also intersect itself.
Add a way to get this kind of intersections, for instance by implying cpml_segment_put_intersections(segment, NULL, n_dest, dest) should return the self-intersactions of segment.