Since An unallocated variable passed as an argument is not PRESENT, your something_recognized_as_not_present
could be an allocatable scalar that has not been allocated, as in the following code
program hello
implicit none
integer :: a
integer, allocatable :: b
a = 5
call print_hello() ! prints "variable not present"
call print_hello(a) ! prints "variable is 5"
call print_hello(b) ! prints "variable not present"
allocate (b, source=3)
call print_hello(b) ! prints "variable is 3"
contains
subroutine print_hello(some_variable)
implicit none
integer, optional :: some_variable
if (present(some_variable)) then
print*,"variable is", some_variable
else
print*,"variable not present"
end if
end subroutine print_hello
end program hello
Quoting fortran: Detecting null-pointer passed as dummy argument - Stack Overflow, the reason your code in the 2nd post works is that
A nonpointer, nonallocatable, optional dummy argument will be treated as not present if associated with a disassociated pointer actual argument.