fix pr/45972
[official-gcc.git] / gcc / testsuite / gfortran.dg / hollerith.f90
blob697ed22d8925e2b22d85c1a154ce09a77558f04b
1 ! { dg-do run }
2 ! PR15966, PR18781 & PR16531
3 implicit none
4 complex(kind=8) x(2)
5 complex a(2,2)
6 character(4) z
7 character z1(4)
8 character(4) z2(2,2)
9 character(80) line
10 integer i
11 integer j
12 real r
13 character(8) c
15 data x /16Habcdefghijklmnop, 16Hqrstuvwxyz012345/
16 data a /8H(i3),abc, 0, 4H(i4), 8H (i9)/
17 data z/4h(i5)/
18 data z1/1h(,1hi,1h6,1h)/
19 data z2/4h(i7),'xxxx','xxxx','xxxx'/
21 z2 (1,2) = 4h(i8)
22 i = 4hHell
23 j = 4Ho wo
24 r = 4Hrld!
25 write (line, '(3A4)') i, j, r
26 if (line .ne. 'Hello world!') call abort
27 i = 2Hab
28 j = 2Hab
29 r = 2Hab
30 c = 2Hab
31 write (line, '(3A4, 8A)') i, j, r, c
32 if (line .ne. 'ab ab ab ab ') call abort
34 write(line, '(4A8, "!")' ) x
35 if (line .ne. 'abcdefghijklmnopqrstuvwxyz012345!') call abort
37 write (line, a) 3
38 if (line .ne. ' 3') call abort
39 write (line, a (1,2)) 4
40 if (line .ne. ' 4') call abort
41 write (line, z) 5
42 if (line .ne. ' 5') call abort
43 write (line, z1) 6
44 if (line .ne. ' 6') call abort
45 write (line, z2) 7
46 if (line .ne. ' 7') call abort
47 write (line, z2 (1,2)) 8
48 if (line .ne. ' 8') call abort
49 write (line, '(16A)') z2
50 if (line .ne. '(i7)xxxx(i8)xxxx') call abort
51 call test (8h hello)
52 end
54 subroutine test (h)
55 integer(kind=8) h
56 character(80) line
58 write (line, '(8a)') h
59 if (line .ne. ' hello') call abort
60 end subroutine
62 ! { dg-warning "Hollerith constant" "const" { target *-*-* } 15 }
63 ! { dg-warning "Conversion" "conversion" { target *-*-* } 15 }
65 ! { dg-warning "Hollerith constant" "const" { target *-*-* } 16 }
66 ! { dg-warning "Conversion" "conversion" { target *-*-* } 16 }
68 ! { dg-warning "Hollerith constant" "const" { target *-*-* } 17 }
70 ! { dg-warning "Hollerith constant" "const" { target *-*-* } 18 }
72 ! { dg-warning "Hollerith constant" "const" { target *-*-* } 19 }
74 ! { dg-warning "Hollerith constant" "const" { target *-*-* } 21 }
75 ! { dg-warning "Conversion" "conversion" { target *-*-* } 21 }
77 ! { dg-warning "Hollerith constant" "const" { target *-*-* } 22 }
78 ! { dg-warning "Conversion" "conversion" { target *-*-* } 22 }
80 ! { dg-warning "Hollerith constant" "const" { target *-*-* } 23 }
81 ! { dg-warning "Conversion" "conversion" { target *-*-* } 23 }
83 ! { dg-warning "Hollerith constant" "const" { target *-*-* } 24 }
84 ! { dg-warning "Conversion" "conversion" { target *-*-* } 24 }
86 ! { dg-warning "Hollerith constant" "const" { target *-*-* } 27 }
87 ! { dg-warning "Conversion" "conversion" { target *-*-* } 27 }
89 ! { dg-warning "Hollerith constant" "const" { target *-*-* } 28 }
90 ! { dg-warning "Conversion" "conversion" { target *-*-* } 28 }
92 ! { dg-warning "Hollerith constant" "const" { target *-*-* } 29 }
93 ! { dg-warning "Conversion" "conversion" { target *-*-* } 29 }
95 ! { dg-warning "Hollerith constant" "const" { target *-*-* } 30 }
96 ! { dg-warning "Conversion" "conversion" { target *-*-* } 30 }
98 ! { dg-warning "Non-character in FORMAT tag" "" { target *-*-* } 37 }
100 ! { dg-warning "Non-character in FORMAT tag" "" { target *-*-* } 39 }
102 ! { dg-warning "Hollerith constant" "" { target *-*-* } 51 }