145
|
1 ! { dg-do compile }
|
|
2 ! { dg-options "-fdec" }
|
|
3 !
|
|
4 ! Test case contributed by Mark Eggleston <mark.eggleston@codethink.com>
|
|
5 !
|
|
6 ! Hollerith constants and character literals are allowed in comparisons,
|
|
7 ! check that character variables can not be compared with numeric variables.
|
|
8
|
|
9 program convert
|
|
10 character(4) :: a = 4hJMAC
|
|
11 integer(4) :: b = "JMAC"
|
|
12 real(4) :: c = "JMAC"
|
|
13 complex(4) :: d = "JMACJMAC"
|
|
14 ! integers
|
|
15 if (a.ne.b) stop 1 ! { dg-error "Operands of comparison" }
|
|
16 if (b.eq.a) stop 2 ! { dg-error "Operands of comparison" }
|
|
17 if (a.ge.b) stop 3 ! { dg-error "Operands of comparison" }
|
|
18 if (b.ge.a) stop 4 ! { dg-error "Operands of comparison" }
|
|
19 if (a.gt.b) stop 5 ! { dg-error "Operands of comparison" }
|
|
20 if (b.gt.a) stop 6 ! { dg-error "Operands of comparison" }
|
|
21 if (a.le.b) stop 3 ! { dg-error "Operands of comparison" }
|
|
22 if (b.le.a) stop 4 ! { dg-error "Operands of comparison" }
|
|
23 if (a.lt.b) stop 5 ! { dg-error "Operands of comparison" }
|
|
24 if (b.lt.a) stop 6 ! { dg-error "Operands of comparison" }
|
|
25 ! reals
|
|
26 if (a.ne.c) stop 7 ! { dg-error "Operands of comparison" }
|
|
27 if (c.eq.a) stop 8 ! { dg-error "Operands of comparison" }
|
|
28 if (a.ge.c) stop 9 ! { dg-error "Operands of comparison" }
|
|
29 if (c.ge.a) stop 10 ! { dg-error "Operands of comparison" }
|
|
30 if (a.gt.c) stop 11 ! { dg-error "Operands of comparison" }
|
|
31 if (c.gt.a) stop 12 ! { dg-error "Operands of comparison" }
|
|
32 if (a.le.c) stop 13 ! { dg-error "Operands of comparison" }
|
|
33 if (c.le.a) stop 14 ! { dg-error "Operands of comparison" }
|
|
34 if (a.lt.c) stop 15 ! { dg-error "Operands of comparison" }
|
|
35 if (c.lt.a) stop 16 ! { dg-error "Operands of comparison" }
|
|
36 ! complexes
|
|
37 a = "JMACJMAC"
|
|
38 if (a.ne.d) stop 17 ! { dg-error "Operands of comparison" }
|
|
39 if (d.eq.a) stop 18 ! { dg-error "Operands of comparison" }
|
|
40 end program
|