From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- gcc/testsuite/gfortran.dg/warn_conversion.f90 | 61 +++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/warn_conversion.f90 (limited to 'gcc/testsuite/gfortran.dg/warn_conversion.f90') diff --git a/gcc/testsuite/gfortran.dg/warn_conversion.f90 b/gcc/testsuite/gfortran.dg/warn_conversion.f90 new file mode 100644 index 000000000..e9b7e396e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/warn_conversion.f90 @@ -0,0 +1,61 @@ +! { dg-do compile } +! { dg-options "-Wconversion" } + +! +! PR fortran/27866 -improve -Wconversion +! +SUBROUTINE pr27866 + double precision :: d + real :: r + d = 4d99 + r = d ! { dg-warning "conversion" } +END SUBROUTINE + +SUBROUTINE pr27866c4 + real(kind=4) :: a + real(kind=8) :: b + integer(kind=1) :: i1 + integer(kind=4) :: i4 + i4 = 2.3 ! { dg-warning "conversion" } + i1 = 500 ! { dg-error "overflow" } + a = 2**26-1 ! assignment INTEGER(4) to REAL(4) - no warning + b = 1d999 ! { dg-error "overflow" } + + a = i4 ! assignment INTEGER(4) to REAL(4) - no warning + b = i4 ! assignment INTEGER(4) to REAL(8) - no warning + i1 = i4 ! { dg-warning "conversion" } + a = b ! { dg-warning "conversion" } +END SUBROUTINE + + +! +! PR fortran/35003 - spurious warning with -Wconversion +! Contributed by Brian Barnes +! +SUBROUTINE pr35003 + IMPLICIT NONE + integer(8) :: i, n + n = 1_8 + + do i = 1_8,n + enddo +END SUBROUTINE + + +! +! PR fortran/42809 - Too much noise with -Wconversion +! Contributed by Harald Anlauf +! +SUBROUTINE pr42809 + implicit none + integer, parameter :: sp = kind (1.0) + integer, parameter :: dp = kind (1.d0) + real(sp) :: s + real(dp) :: d + complex(dp) :: z + + s = 0 ! assignment INTEGER(4) to REAL(4) - no warning + d = s ! assignment REAL((8)) to REAL(4) - no warning + z = (0, 1) ! conversion INTEGER(4) to REAL(4), + ! assignment COMPLEX(4) to COMPLEX(8) - no warning +END SUBROUTINE -- cgit v1.2.3