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

--- Comment #2 from ygal klein <ygalklein at gmail dot com> ---
The problem also persists in an example code that is with no extended type:

```fortran
module mod_original_struct
    implicit none

    private
    public :: original_struct

    type original_struct
        private
        real, PUBLIC :: var1
        contains

        private
        procedure, public :: init=>initoriginal_struct, advance
    end type original_struct

    contains

    subroutine advance(this)
        class(original_struct), intent(inout) :: this
        print*, 'head of advance, this%var1 = ', this%var1
        call this%init(var1=this%var1)
    end subroutine advance

    subroutine initoriginal_struct(this, var1)
        class(original_struct), intent(out) :: this
        real, intent(in) :: var1
        print*, 'head of initoriginal_struct, the input argument var1 = ', var1
        this%var1 = var1
    end subroutine initoriginal_struct

end module mod_original_struct

program example
    use mod_original_struct, only: original_struct
    implicit none
    type(original_struct) :: struct1
    call struct1%init(var1=10.)
    print*, 'bf advance, struct1%var1 = ', struct1%var1
    call struct1%advance()
end program example
```

The gfortran wrong output is:

 head of initoriginal_struct, the input argument var1 =    10.000000000000000   
 bf advance, struct1%var1 =    10.000000000000000     
 head of advance, this%var1 =    10.000000000000000     
 head of initoriginal_struct, the input argument var1 =    0.0000000000000000 

using intel 2020u4 provides the right output.

Reply via email to