This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch/gfortran] Fix for PR16939


[ my original reply didn't make it to the list ]

THOMAS Paul Richard 169137 wrote:
>>Oh, and I'm wondering if I should have added 
>>> !sym->attr.pointer to that
> 
> 
> I think that your next remark is right.

I'll look into this later today.

> The reason that my patches appeared to be broken is that something nasty
> happened to the test cases, in a place that I do not think I have touched
> (attr.function and attr.result now behave differently).
> 
> This fails with a seg fault:
> 
> program testch
>   print *, ch()
> contains
>   function ch result(str)
>     character(len = 10),pointer  :: str
>     str ="hello"
>   end function ch
> end program testch
> 
> This works:
> 
> program testch
>   print *, ch()
> contains
>   function ch
>     character(len = 10)  :: ch
>     ch ="hello"
>   end function ch
> end program testch

Bleh, we need to make sure that every function has sym->result's properties
set consistently with sym's properties.  That way we could do away with a lot
of special cases.  There is code for this in resolve_formal_arglist but it
doesn't handle everything, because all those special cases that are scattered
around the code generation passes wouldn't be necessary then.

I remember changing sym vs. sym->result in a few places (sorry, it's been two
months since I wroter the f2c patch, and I only briefly scanned through it for
completeness yesterday).  I mostly trying to make this stuff more consistent,
but it could be that it interferes with some character stuff, where
inconsistencies may have been the other way round or some similar nastiness.

- Tobi


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]