1! { dg-do compile }
2!
3program test
4
5  print *, char(255)
6  print *, achar(255)
7  print *, char(255,kind=1)
8  print *, achar(255,kind=1)
9  print *, char(255,kind=4)
10  print *, achar(255,kind=4)
11
12  print *, char(0)
13  print *, achar(0)
14  print *, char(0,kind=1)
15  print *, achar(0,kind=1)
16  print *, char(0,kind=4)
17  print *, achar(0,kind=4)
18
19  print *, char(297) ! { dg-error "too large for the collating sequence" }
20  print *, achar(297) ! { dg-error "too large for the collating sequence" }
21  print *, char(297,kind=1) ! { dg-error "too large for the collating sequence" }
22  print *, achar(297,kind=1) ! { dg-error "too large for the collating sequence" }
23  print *, char(297,kind=4)
24  print *, achar(297,kind=4)
25
26  print *, char(-1) ! { dg-error "negative" }
27  print *, achar(-1) ! { dg-error "negative" }
28  print *, char(-1,kind=1) ! { dg-error "negative" }
29  print *, achar(-1,kind=1) ! { dg-error "negative" }
30  print *, char(-1,kind=4) ! { dg-error "negative" }
31  print *, achar(-1,kind=4) ! { dg-error "negative" }
32
33  print *, char(huge(0_8)) ! { dg-error "too large for the collating sequence" }
34  print *, achar(huge(0_8)) ! { dg-error "too large for the collating sequence" }
35  print *, char(huge(0_8),kind=1) ! { dg-error "too large for the collating sequence" }
36  print *, achar(huge(0_8),kind=1) ! { dg-error "too large for the collating sequence" }
37  print *, char(huge(0_8),kind=4) ! { dg-error "too large for the collating sequence" }
38  print *, achar(huge(0_8),kind=4) ! { dg-error "too large for the collating sequence" }
39
40  print *, char(z'FFFFFFFF', kind=4)
41  print *, achar(z'FFFFFFFF', kind=4)
42  print *, char(z'100000000', kind=4) ! { dg-error "too large for the collating sequence" }
43  print *, achar(z'100000000', kind=4) ! { dg-error "too large for the collating sequence" }
44
45end program test
46