1! { dg-do compile }
2! { dg-options "-fall-intrinsics -std=f95" }
3! PR15966, PR18781 & PR16531
4implicit none
5complex(kind=8) x(2)
6complex a(2,2)
7character(4) z
8character z1(4)
9character(4) z2(2,2)
10character(80) line
11integer i
12logical l
13real r
14character(8) c
15
16data x /16Habcdefghijklmnop, 16Hqrstuvwxyz012345/
17data a /8H(i3),abc, 0, 4H(i4), 8H    (i9)/
18data z/4h(i5)/
19data z1/1h(,1hi,1h6,1h)/
20data z2/4h(i7),'xxxx','xxxx','xxxx'/
21
22z2 (1,2) = 4h(i8)
23i = 4hHell
24l = 4Ho wo
25r = 4Hrld!
26write (line, '(3A4)') i, l, r
27if (line .ne. 'Hello world!') call abort
28i = 2Hab
29r = 2Hab
30l = 2Hab
31c = 2Hab
32write (line, '(3A4, 8A)') i, l, r, c
33if (line .ne. 'ab  ab  ab  ab      ') call abort
34
35write(line, '(4A8, "!")' ) x
36if (line .ne. 'abcdefghijklmnopqrstuvwxyz012345!') call abort
37
38write (line, a) 3
39if (line .ne. '  3') call abort
40write (line, a (1,2)) 4
41if (line .ne. '   4') call abort
42write (line, z) 5
43if (line .ne. '    5') call abort
44write (line, z1) 6
45if (line .ne. '     6') call abort
46write (line, z2) 7
47if (line .ne. '      7') call abort
48write (line, z2 (1,2)) 8
49if (line .ne. '       8') call abort
50write (line, '(16A)') z2
51if (line .ne. '(i7)xxxx(i8)xxxx') call abort
52call test (8h   hello)
53end
54
55subroutine test (h)
56integer(kind=8) h
57character(80) line
58
59write (line, '(8a)') h
60if (line .ne. '   hello') call abort
61end subroutine
62
63! { dg-error "Hollerith constant" "const" { target *-*-* } 16 }
64
65! { dg-error "Hollerith constant" "const" { target *-*-* } 17 }
66
67! { dg-error "Hollerith constant" "const" { target *-*-* } 18 }
68
69! { dg-error "Hollerith constant" "const" { target *-*-* } 19 }
70
71! { dg-error "Hollerith constant" "const" { target *-*-* } 20 }
72
73! { dg-error "Hollerith constant" "const" { target *-*-* } 22 }
74
75! { dg-error "Hollerith constant" "const" { target *-*-* } 23 }
76
77! { dg-error "Hollerith constant" "const" { target *-*-* } 24 }
78
79! { dg-error "Hollerith constant" "const" { target *-*-* } 25 }
80
81! { dg-error "Hollerith constant" "const" { target *-*-* } 28 }
82
83! { dg-error "Hollerith constant" "const" { target *-*-* } 29 }
84
85! { dg-error "Hollerith constant" "const" { target *-*-* } 30 }
86
87! { dg-error "Hollerith constant" "const" { target *-*-* } 31 }
88
89! { dg-error "Hollerith constant" "const" { target *-*-* } 52 }
90
91! { dg-error "Non-character in FORMAT tag" "" { target *-*-* } 38 }
92
93! { dg-error "Non-character in FORMAT tag" "" { target *-*-* } 40 }
94