A safe pointer can be associated to any pointer (safe or not) or target object
For example:
integer, pointer, safe :: p
call allocate_it
print *, p
call associate_it
print *, p ! invalid to reference p now
contains
subroutine allocate_it
allocate(p)
p = 42
end subroutine
subroutine associate_it
integer, target :: t
t = 42
p => t ! the previously allocated p will be deallocated?
end subroutine
end
As described, your proposal does not ensure this error gets detected at compile time, but at run time the reference to p in the second print statement is still invalid. And actually, now that I look at it, a small change to the above example actually reintroduces the memory leak.
integer, pointer, safe :: p
call allocate_it
print *, p
call associate_it
print *, p ! invalid to reference p now
contains
subroutine allocate_it
integer, pointer :: p2
allocate(p2)
p2 = 42
p => p2
end subroutine
subroutine associate_it
integer, target :: t
t = 42
p => t ! p wasn't allocated as "safe", so memory leak still here
end subroutine
end