[Bug fortran/80009] Printing/writing a structure with a real edit descriptor.

walt.brainerd at gmail dot com gcc-bugzilla@gcc.gnu.org
Sat Jun 10 17:07:00 GMT 2017


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

--- Comment #12 from Walt Brainerd <walt.brainerd at gmail dot com> ---
I made a misstatement in my previous message.
gfortran 7.0.1 does not accept this.

Sorry, my "test" was not correct.

I am going to post a query to comp-fortran-90 to see what others think.

On Fri, Jun 9, 2017 at 12:08 PM, Walt Brainerd <walt.brainerd@gmail.com>
wrote:

> 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.
>
>
>
>
> --
> Walt Brainerd
>


More information about the Gcc-bugs mailing list