1! { dg-do compile }
2! { dg-options "-Wconversion" }
3! PR 47359 - additional warnings for conversions.
4program main
5  implicit none
6  complex(kind=4) :: c4
7  complex(kind=8) :: c8
8  real(kind=4) :: r4
9  real(kind=8) :: r8
10  complex(kind=4), parameter :: c4p = (1.0, -4.)
11  complex, parameter :: c8w = (1.0_8, -4.2_8) ! { dg-warning "Change of value in conversion" }
12  complex (kind=8), parameter :: c8p = (1.0_8, -4.2_8)
13  integer :: i
14
15  c4 = c8p ! { dg-warning "Change of value in conversion" }
16  c4 = 2**26 + 1 ! { dg-warning "Change of value in conversion" }
17  c4 = 1.3d0     ! { dg-warning "Change of value in conversion" }
18  c4 = c8p       ! { dg-warning "Change of value in conversion" }
19  c4 = (1.2, 1000000001) ! { dg-warning "Change of value in conversion" }
20  r4 = (2**26 + 1) * 2.3 ! { dg-warning "Change of value in conversion" }
21  r4 = 2.4d0 ! { dg-warning "Change of value" }
22  r4 = c4p ! { dg-warning "Non-zero imaginary part" }
23  r4 = r4 + 2.3d0 ! { dg-warning "Possible change of value in conversion" }
24  r8 = 2_8**62 - 1_8 ! { dg-warning "Change of value in conversion" }
25  i = c4p ! { dg-warning "Non-zero imaginary part" }
26  i = 42 + 1.3 ! { dg-warning "Change of value in conversion" }
27  i = (1.2, 0.) ! { dg-warning "Change of value in conversion" }
28  c4 = 1.2       ! no warning
29  c4 = -3.25d0   ! no warning
30  c4 = -42       ! no warning
31  c8 = 2**26 + 1 ! no warning
32  i = 22.        ! no warning
33  i = (35., 0.)  ! no warning
34  r4 = 2.5d0     ! no warning
35  r4 = 235       ! no warning
36  r8 = 2.3       ! no warning
37end program main
38