Problem after reading binary file with windows gfortran

I tidied up the code, but did not reproduce your error for the text file.
I included routines to first write the files and a more consistent approach to using and reporting the iostat return from open.

I think your problem may be with the files you are opening.
Does your txt file have a end of line character as <CR><LF> ?

Why do you use RETURN in the main program ?

subroutine readtxt
  t = 0.0
  open ( newunit=kf, file='toto.txt', form='FORMATTED',  &
         status='OLD', action='https://fortran-lang.discourse.group/READ', iostat=IPB)
  if (IPB==0) read(kf,*) t
  print*,'readtxt : t=',t,' ipb=',ipb
  close(kf)
  return
end

subroutine readbin
  x = 0
  OPEN (newunit=io, FILE='toto.bin', ACCESS='STREAM',   &
        FORM='UNFORMATTED', STATUS='OLD', IOSTAT=IPB )
  if (IPB==0) read(io) x
  print*,'readbin : x=',x,' ipb=',ipb
  close(io)
  return
end

program toto
  call writetxt
  call writebin
  do k = 1,3
    call readtxt
    call readtxt
    call readbin
    call readtxt
    call readtxt
  end do
return   ! why this ?
end

subroutine writetxt
  t = 0
  open ( newunit=kf, file='toto.txt', form='FORMATTED',  &
         status='UNKNOWN', iostat=IPB)
  if (IPB==0) then
    t = 123.456
    write(kf,*) t
  end if
  print*,'writetxt : t=',t,' ipb=',ipb
  close (kf)
  return
end subroutine writetxt

subroutine writebin
  x = 0
  OPEN (newunit=io, FILE='toto.bin', ACCESS='STREAM',   &
        FORM='UNFORMATTED', STATUS='unknown', IOSTAT=IPB )
  if (IPB==0) then
    x = 234.567
    write(io) x
  end if
  print*,'writebin : x=',x,' ipb=',ipb
  close (io)
  return
end

ps : including text in posts on this forum is becoming a bit of an art !