2 ! { dg-options "-fdec" }
4 ! Test case contributed by Mark Eggleston <mark.eggleston@codethink.com>
6 ! Hollerith constants and character literals are allowed in comparisons,
7 ! check that character variables can not be compared with numeric variables.
10 character(4) :: a
= 4hJMAC
11 integer(4) :: b
= "JMAC"
13 complex(4) :: d
= "JMACJMAC"
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" }
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" }
38 if (a
.ne
.d
) stop 17 ! { dg-error "Operands of comparison" }
39 if (d
.eq
.a
) stop 18 ! { dg-error "Operands of comparison" }