Silverfrost Forums

Welcome to our forums

Regression with NULL(?) pointers in FTN 8.20

20 Mar 2018 1:25 #21644

I found a regression in FTN95/64. Consider the following program:

module bar
    implicit none
contains
    subroutine foo()
        integer, pointer :: p => null()
        write(*,*) loc(p)
    end subroutine
end module

program pointer
    use bar
    implicit none

    call foo()
end program

Compiled with

ftn95 main.f90 /link

this works just fine (gives 0 as output). However, if I compile with

ftn95 /64 main.f90 /link

my output is 8589934592, which is definitely wrong. This worked fine for FTN95 8.10.

Interestingly, if foo is external (i.e. not defined within a CONTAINS scope) or if I define the pointer within the main PROGRAM, the problem does not seem to appear.

Part 2:

Even more interesting, if I add a NULLIFY(p) just below the pointer definition, FTN64 gives me the following weird error message: https://image.ibb.co/bBDKCx/ftn_bug.png This is definitely a bug (and also a regression to FTN95 8.10).

...continuation: Part 2 is even more involved than I first thought. Consider the following code:

module bar
    implicit none
contains
    subroutine foo()
        integer, pointer :: p => null()
        write(*,*) loc(p)
    end subroutine
end module

program pointer
    implicit none
    integer, pointer :: pp => null()

    nullify(pp)
    write(*,*) loc(pp)

end program

Same weird error message in 64 bit. However if I remove subroutine foo (which I am not using anyway), the program works fine again. Everything works fine in FTN 8.10.

20 Mar 2018 2:23 #21645

The same result is obtained with the current release (v8.30). I have made a note that this needs investigating.

21 Mar 2018 11:42 #21648

This has been fixed for the next release of FTN95.

Anyone who needs this construction immediately should update to version 8.30 and then send me a message on this forum so that I can provide a link to a new FTN95.

Please login to reply.