PR libfortran/62768 Handle filenames with embedded null characters.
[official-gcc.git] / gcc / testsuite / gfortran.dg / filename_null.f90
blobf24d2438dafb55b0407c18a89dc5f1969198167e
1 ! { dg-do run }
2 ! PR 62768
3 ! Filenames with embedded NULL characters are truncated, make sure
4 ! inquire reports the correct truncated name.
5 program filename_null
6 implicit none
7 character(len=15), parameter :: s = "hello" // achar(0) // "world", &
8 s2 = "hello"
9 character(len=15) :: r
10 logical :: l
11 open(10, file=s)
12 inquire(unit=10, name=r)
13 if (r /= s2) call abort()
14 inquire(file=s2, exist=l)
15 if (.not. l) call abort()
16 close(10, status="delete")
17 end program filename_null