| 1 |
! { dg-do compile } |
| 2 |
! { dg-options "-Wsurprising" } |
| 3 |
! |
| 4 |
! PR fortran/53691 |
| 5 |
! PR fortran/53685 |
| 6 |
! |
| 7 |
! TRANSFER checks |
| 8 |
|
| 9 |
|
| 10 |
! (a) PR 53691 |
| 11 |
! Failed for -Wsurprising with an ICE as SIZE was assumed to be constant |
| 12 |
|
| 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 |
| 20 |
|
| 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) |
| 24 |
|
| 25 |
subroutine test(j) |
| 26 |
implicit none |
| 27 |
character(len=4) :: record_type |
| 28 |
integer :: i, j |
| 29 |
|
| 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 |