[Bug fortran/30793] Segfault on calling a function returning a pointer

sfilippone at uniroma2 dot it gcc-bugzilla@gcc.gnu.org
Thu Feb 15 10:42:00 GMT 2007



------- Comment #11 from sfilippone at uniroma2 dot it  2007-02-15 10:42 -------
(In reply to comment #10)
> > > I have still to re-read the test case to check whether TARGET is required
> >
> > However   the accessed component is a POINTER to a derived type [...]
> 
> Ok, I somehow didn't realize
>   type field
>      type(mesh),     pointer :: msh   => null()
> when I read
>     msh_ => fld%msh
> One does not assign msh_ the variable fld%msh as target, but one assignes the
> target of the pointer fld%msh to the pointer msh_.
Yes, exactly: that's an object that has an independent life, is pointed to from
the field object, and I want to get access to it. 
> 
> But I don't understand why xlf does not like the TARGET attribute.
> 
Beats me. But I guess I'd be happy enough to have gfortran working, for the
time being. 
Actually I already have a workaround: instead of a function, put a subroutine 
    call get_mesh(mshp,fld)
which internally does  
    mshp => fld%msh
works perfectly. Why? 


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30793



More information about the Gcc-bugs mailing list