Fix compilation failure with C++98 compilers
[official-gcc.git] / gcc / testsuite / gfortran.dg / read_bang4.f90
blob6f5d282891abccb728bc1a705db08f54ebb8b104
1 ! { dg-do run }
2 ! PR69651 Usage of unitialized pointer io/list_read.c
3 ! Note: The uninitialized pointer was not the cause of the problem
4 ! observed with this test case. This tests the case with UTF-8
5 ! files. The large string test the realloc use in push_char4 of
6 ! list_read.c
7 program test
8 implicit none
9 integer :: i, j, k, ios
10 integer, parameter :: big = 600
11 real :: r, s
12 complex :: c, d
13 character(kind=4,len=big) :: str1, str2, str3
15 do i=1,big, 10
16 do j = 0, 9
17 k = i + j
18 str2(k:k) = char(65+j)
19 end do
20 end do
21 i = -5
22 j = -6
23 r = -3.14
24 s = -2.71
25 c = (-1.1,-2.2)
26 d = (-3.3,-4.4)
27 str3 = str2
28 open(15, status='scratch', encoding="utf-8")
29 write(15,*) "10 1!2"
30 write(15,*) " 23.5! 34.5"
31 write(15,*) " (67.50,69.25) (51.25,87.75)!"
32 write(15,*) " 'abcdefgh!'", " ", str2
33 rewind(15)
34 str1 = 4_"candy"
35 str2 = 4_"peppermint"
36 read(15,*,iostat=ios) i, j
37 if (ios.ne.5010) STOP 1
38 read(15,*,iostat=ios) r, s
39 if (ios.ne.5010) STOP 2
40 read(15,*,iostat=ios) c, d
41 if (ios.ne.5010) STOP 3
42 read(15,*,iostat=ios) str1, str2
43 if (ios.ne.0) STOP 4
44 if (str1.ne.4_"abcdefgh!") STOP 5
45 if (str2.ne.str3) STOP 6
46 close(15)
47 end program