http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46339
--- Comment #26 from Paul Thomas <pault at gcc dot gnu.org> 2010-11-21 07:18:04 UTC --- (In reply to comment #0) > The test program is: ....snip.... > type (particle_struct), optional, target :: p(:) > real, pointer, optional :: axis(:) > > axis => p%r%vec(1) > > end subroutine tao_phase_space_axis > > end module 'axis' gets labeled, correctly, as a subref_array_pointer. The 'span' variable that is meant to deal with this is generated in trans-decl.c:gfc_get_symbol_decl at line 1266, onwards. Dummy variables have already been returned at line 1136, as remarked in the comment at line 1084. Since 'axis' is a dummy, it means that the 'span' variable will not exist and this is the cause of the segfault. Now, we could remedy this directly by adding the 'span' variable to dummies. The reason that this was not done is that it cannot be returned to the caller. We have a choice here: (i) Hope that the dummy is returned, pointing to something less complicated (ie. the span value is the same as the actual argument element size); (ii) Copy the passing of character lengths; or (iii) Add the requisite field to the descriptor. (i)-(ii) Are consistent with being in stage 3. (ii) Would not hit the API because the segfault is bound to occur otherwise. This is not a regression because the incorrect result was returned in gcc-4.2 and earlier. Cheers Paul