Unexpected result and Bus error with PGI-18.10 fortran

Dear Sir,
The following code gives an unexpected result and a bus error with PGI 18.10 Fortran (Community edition).

module conf_m
    implicit none
    integer, parameter :: dp = kind(0.0d0)

    type conf_t
        real(dp), allocatable :: x(:), v(:)
    contains
        procedure :: set
        procedure :: show
    endtype

contains

subroutine set( self, x, v )

    class(conf_t) :: self
    real(dp), intent(in), optional :: x(:), v(:)

    if (present( x )) self% x(:) = x(:)
    if (present( v )) self% v(:) = v(:)
end

subroutine show( self, msg )

    class(conf_t) :: self
    character(*), intent(in), optional :: msg

    if (present( msg )) print *, msg

    print *, "x = ", self% x
    print *, "v = ", self% v
end

end module

program main
    use conf_m
    implicit none
    type(conf_t) :: conf
    real(dp) :: x( 2 ), v( 2 )

    allocate( conf% x( 2 ), conf% v( 2 ) )

    call conf% set( x = [1.0d0, 2.0d0], v = [3.0d0, 4.0d0] )

    call conf% show()                    ! NG (incorrect result for x)
    call conf% show( msg = "test" )  ! NG (bus error)
end

pgfortran gives this output (which is incorrect
for x)

x = 0.000000000000000 0.000000000000000
v = 3.000000000000000 4.000000000000000
Bus error: 10

while gfortran-8.2 gives this output (which is what I
expect):

x = 1.0000000000000000 2.0000000000000000
v = 3.0000000000000000 4.0000000000000000
test
x = 1.0000000000000000 2.0000000000000000
v = 3.0000000000000000 4.0000000000000000

Though I am not 100% sure whether the above code
is standard-conforming, I am afraid it may be a compiler
issue of PGI-18.4.

Thanks for the report tbzy.

I’ve added problem report (TPR #27051) and have sent it to our compiler engineers to investigate.

Best Regards,
Mat

We’ve fixed this with 19.7, should be included in that version and above.