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/80009] Printing/writing a structure with a real edit descriptor.


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

--- Comment #11 from Walt Brainerd <walt.brainerd at gmail dot com> ---
I am not sure what you changed your mind from or to :-).

Yes, the assignment is invalid because r is real the the rhs is type B_type.

And, yes, the type of the io list item is B_type.

However, the uncommented WRITE statement is valid, and,
in the absence or a DT edit descriptor, the components (one real) are
written in order, so 20.0 is written with f4.1 format.

ifort 2017 and gfortran 7.01. both agree with this (maybe the latter
because of you).

If you disagree with this, I would be happy to solicit opinions from more
experts.

On Thu, Jun 8, 2017 at 10:05 PM, jvdelisle at gcc dot gnu.org <
gcc-bugzilla@gcc.gnu.org> wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80009
>
> --- Comment #10 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
> After a lot of head scratching I think I am changing my mind on this one.
>
> If one tries to assign to a real variable as in:
>
> program test_b_write_dt_mod
>
>    use :: B_write_dt_mod
>    implicit none
>
>    type(B_type) :: x != B_type(20.0)
>    real :: r
>
>    r = B_type(20.0)
>
>    write (unit=*, fmt="(f4.1)") B_type(20.0)
>    !write (unit=*, fmt="(f4.1)") x
>
> end program test_b_write_dt_mod
>
> The effective item is of type B_type not real and the assignment to r is
> rejected.
>
> So I believe the effective type in the write statement is likewise derived
> type
> ad not real.
>
> My thinking is this PR is invalid.
>
> --
> You are receiving this mail because:
> You reported the bug.

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