2017-02-20 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / real_compare_1.f90
blobfd8417706c5557dc9eecb9f34f9e65ecc797f1e1
1 ! { dg-do compile }
2 ! { dg-options "-Wcompare-reals" }
3 program main
4 real :: a
5 complex :: c
6 read (*,*) a
7 read (*,*) c
8 if (a .eq. 3.14) print *,"foo" ! { dg-warning "Equality comparison for REAL" }
9 if (3.14 == a) print *,"foo" ! { dg-warning "Equality comparison for REAL" }
10 if (a .eq. 3) print *,"foo" ! { dg-warning "Equality comparison for REAL" }
11 if (3. == a) print *,"foo" ! { dg-warning "Equality comparison for REAL" }
12 if (a .ne. 4.14) print *,"foo" ! { dg-warning "Inequality comparison for REAL" }
13 if (4.14 /= a) print *,"foo" ! { dg-warning "Inequality comparison for REAL" }
14 if (a .ne. 4) print *,"foo" ! { dg-warning "Inequality comparison for REAL" }
15 if (4 /= a) print *,"foo" ! { dg-warning "Inequality comparison for REAL" }
17 if (c .eq. (3.14, 2.11)) print *,"foo" ! { dg-warning "Equality comparison for COMPLEX" }
18 if ((3.14, 2.11) == a) print *,"foo" ! { dg-warning "Equality comparison for COMPLEX" }
19 if (c .ne. (3.14, 2.11)) print *,"foo" ! { dg-warning "Inequality comparison for COMPLEX" }
20 if ((3.14, 2.11) /= a) print *,"foo" ! { dg-warning "Inequality comparison for COMPLEX" }
21 end program main