| 1 |
! { dg-do compile } |
| 2 |
! { dg-options "-std=legacy -Wsurprising" } |
| 3 |
! PR15966, PR18781 & PR16531 |
| 4 |
implicit none |
| 5 |
complex(kind=8) x(2) |
| 6 |
complex a(2,2) |
| 7 |
character*4 z |
| 8 |
character z1(4) |
| 9 |
character*4 z2(2,2) |
| 10 |
character*80 line |
| 11 |
integer i |
| 12 |
logical l |
| 13 |
real r |
| 14 |
character*8 c |
| 15 |
|
| 16 |
data x /16Habcdefghijklmnop, 16Hqrstuvwxyz012345/ |
| 17 |
data a /8H(i3),abc, 0, 4H(i4), 8H (i9)/ |
| 18 |
data z/4h(i5)/ |
| 19 |
data z1/1h(,1hi,1h6,1h)/ |
| 20 |
data z2/4h(i7),'xxxx','xxxx','xxxx'/ |
| 21 |
|
| 22 |
z2 (1,2) = 4h(i8) |
| 23 |
i = 4hHell |
| 24 |
l = 4Ho wo ! { dg-warning "has undefined result" } |
| 25 |
r = 4Hrld! |
| 26 |
write (line, '(3A4)') i, l, r |
| 27 |
if (line .ne. 'Hello world!') STOP 1 |
| 28 |
i = 2Hab |
| 29 |
r = 2Hab |
| 30 |
l = 2Hab ! { dg-warning "has undefined result" } |
| 31 |
c = 2Hab |
| 32 |
write (line, '(3A4, 8A)') i, l, r, c |
| 33 |
if (line .ne. 'ab ab ab ab ') STOP 2 |
| 34 |
|
| 35 |
write(line, '(4A8, "!")' ) x |
| 36 |
if (line .ne. 'abcdefghijklmnopqrstuvwxyz012345!') STOP 3 |
| 37 |
|
| 38 |
write (line, a) 3 |
| 39 |
if (line .ne. ' 3') STOP 4 |
| 40 |
write (line, a (1,2)) 4 |
| 41 |
if (line .ne. ' 4') STOP 5 |
| 42 |
write (line, z) 5 |
| 43 |
if (line .ne. ' 5') STOP 6 |
| 44 |
write (line, z1) 6 |
| 45 |
if (line .ne. ' 6') STOP 7 |
| 46 |
write (line, z2) 7 |
| 47 |
if (line .ne. ' 7') STOP 8 |
| 48 |
write (line, z2 (1,2)) 8 |
| 49 |
if (line .ne. ' 8') STOP 9 |
| 50 |
write (line, '(16A)') z2 |
| 51 |
if (line .ne. '(i7)xxxx(i8)xxxx') STOP 10 |
| 52 |
call test (8h hello) |
| 53 |
end |
| 54 |
|
| 55 |
subroutine test (h) |
| 56 |
integer(kind=8) h |
| 57 |
character*80 line |
| 58 |
|
| 59 |
write (line, '(8a)') h |
| 60 |
if (line .ne. ' hello') STOP 11 |
| 61 |
end subroutine |