2017-02-20 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / transfer_check_3.f90
blobd0a52c27bdb760a9f1f4703a988d3465f24aceb6
1 ! { dg-do compile }
2 ! { dg-options "-Wsurprising" }
4 ! PR fortran/53691
5 ! PR fortran/53685
7 ! TRANSFER checks
10 ! (a) PR 53691
11 ! Failed for -Wsurprising with an ICE as SIZE was assumed to be constant
13 SUBROUTINE CGBRFSX(N, RWORK)
14 INTEGER N
15 REAL RWORK(*)
16 REAL ZERO
17 PARAMETER (ZERO = 0.0E+0)
18 call foo(TRANSFER (RWORK(1:2*N), (/ (ZERO, ZERO) /), N))
19 end
21 ! (b) PR 53685
22 ! Failed with a bogus size warning if the source's size is not known at compile
23 ! time (for substrings, the length wasn't set)
25 subroutine test(j)
26 implicit none
27 character(len=4) :: record_type
28 integer :: i, j
30 i = transfer (record_type, i) ! no warning
31 i = transfer (record_type(1:4), i) ! gave a warning
32 i = transfer (record_type(1:j), i) ! gave a warning
33 end