Allocation of array for reading strings from a text file

Thank you, @RonShepard. I corrected this part of the code, but I still encountered a problem. As you mentioned, the issue was that the value returned by index() was relative to the dummy argument and not the original string. Below, I am sharing the corrected version in case someone else makes the same mistake and is looking for a solution:

  do while (ipos.ne.0)
     ipos = index(text(i_start:len_text),new_line("")) ! note that ipos is relative to (i_start:len_text) and not absolute
     if (ipos == 0) exit
     print*, 'ipos = ', ipos
     print*, 'line(', i, ') = ', text(i_start:i_start+ipos-1)
     i = i + 1
     i_start = ipos + i_start ! istart is an absolute-value w.r.t to the entire original text
  end do