It's maybe not really my taste to make the super-type just the first
component of the derived type (if attr.extended is on). I'd probably
include another pointer in the derived type structure itself (besides
"components"), say, "super"; but that's probably a symptom of my usual hang
for overpowered designing... Another idea would be to define a
macro/function to access the super-type. But both of those are probably not
really necessary, just go ahead :)
The whole point of derived type extension is that the parent is NOT a
super type. It's components are part of the extension. It was a
whole lot easier to include the parent derived type rather than its
extension because existing code to find components could be used.
! if (extended && !sym->components)
! {
! gfc_component *p;
! gfc_symtree *st;
I've not looked thoroughly at the code, but why is the this check for
!sym->components? When could there already be components? Why don't we
need to add the super-type in that case? Quickly and without knowing the
details, I'd say an assertion would be better?
Believe it or not, this code to build the derived type seems to be
visited more than once. I will check this because this is a fault, if
so. The check came about to stop the parent derived type being added
more than once. As I say, I will check this thoroughly.