This is the mail archive of the gcc-bugs@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]

[Bug fortran/78661] [OOP] Namelist output missing object designator under DTIO


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78661

--- Comment #26 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
(In reply to janus from comment #25)
> (In reply to Jerry DeLisle from comment #24)
> > I dont think the parent is suppose to emit the Object name. What if there
> > are multiple components?
> 
> Huh, I'm not sure. But your statement contradicts Ian's claim in comment #0:
> 
> > UDDTIO procedures are responsible for writing/reading the value part of the
> > name-value subsequence, the processor still has responsibility for the name=
> > part.

yes I am contradicting, but really asking the question.  Suppose a derived type
has 10 components.  If the parent is to emit the object names there are two
choices for the parent:


1) Only emit the parent name and do not emit the component names, allowing the
child procedure to emit all component values with one procedure call from the
parent. User could emit the child object names in some manner if they choose.

2) Emit parent and component names and call the user defined procedure once per
component, in other words 10 calls to get the whole thing. This makes no sense
at all.

Under option 1) we could do something like this:

&NML    ! parent emits this line
 X=     ! parent emits this line
     !child emits whatever they want component names or no component names
     !entirely up to the users definition
     x%data1 = value1
     x%data2 = value2
     x%data3 = value3
 Y=    ! parent emits this line
     !ditto on child


 /

.... snip ....
> "When the designator in the input record represents an array variable or a
> variable of derived type, the effect is as if the variable represented were
> expanded into a sequence of scalar list items, in the same way that
> formatted input/output list items are expanded (9.6.3)."
> 


> None of them makes a clear statement about DTIO namelist output. Apparently
> two forms are possible: Either having the whole DT variable, or its
> components separately.
> 
> To me it sounds like we should print the variable name (and not the
> component names) if the namelist contains a full DT variable (and not just
> some components).
> 

I agree with your last statement here in the case where there is a user defined
procedure.  Where there is not a user defined procedure, we do exactly what we
have done all along with gfortran, and print the component qualifier.

Let me apply you latest patch, I will prepare the two cases with and without
user defined I/O and show results here.

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