I was wondering about something: does anyone know of a slick way to make a copy of a linked list so that the pointers in the new list don't point back to the original list? Basically, to clone it so that the two are complete independent, but contain the same data. allocate(new,source=old) doesn't work because the new pointers point the same locations as the old ones. I suspect such a thing isn't possible, without manually traversing the structure, but was wondering if anyone had any ideas. I think the Fortran 2008 "Allocatable components of recursive type" feature might make something like this easier?
For more complete information about compiler optimizations, see our Optimization Notice.