diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gfortran.dg/warn_conversion.f90 | |
download | cbb-gcc-4.6.4-upstream.tar.bz2 cbb-gcc-4.6.4-upstream.tar.xz |
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
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.
Diffstat (limited to 'gcc/testsuite/gfortran.dg/warn_conversion.f90')
-rw-r--r-- | gcc/testsuite/gfortran.dg/warn_conversion.f90 | 61 |
1 files changed, 61 insertions, 0 deletions
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 <bcbarnes AT gmail DOT com> +! +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 <anlauf AT gmx DOT de> +! +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 |