This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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] PR 21625: Initialization of derived types at allocation


On Wed, Oct 19, 2005 at 08:43:52PM +0200, Paul Thomas wrote:
> Erik,
> 
> These are probably a naive questions:
> 
> (1) Why do you add the intialization in resolve_code rather than 
> match.c(gfc_match_allocate)? The derived type is available at match 
> time, isn't it?

No very strong reason, really.  I had to put it somewhere, and
resolve_code seemd to be one poosibility.  Since I could make it
work reasonably easily there, I decided to go for that
alternative. If it's belived that match.c(gfc_match_allocate)
would be a better place, I can see if I can move it there.

> (2) What is the business about making the last reference full?

Assume a case like

        allocate(a(5))

Without the 'last reference full' stuff the initialization
statement would become

        a(5) = <...>

i.e., we would initialize only the last element in the array.  By
turning the reference into a reference of the full array, it turns into

        a = <...>

instead.

> You might just call the testcase derived_init_1.f90.

yes.



        Erik


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