File: transfer_check_4.f90

package info (click to toggle)
gcc-arm-none-eabi 15%3A14.2.rel1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,099,328 kB
  • sloc: cpp: 3,627,108; ansic: 2,571,498; ada: 834,230; f90: 235,082; makefile: 79,231; asm: 74,984; xml: 51,692; exp: 39,736; sh: 33,298; objc: 15,629; python: 15,069; fortran: 14,429; pascal: 7,003; awk: 5,070; perl: 3,106; ml: 285; lisp: 253; lex: 204; haskell: 135
file content (44 lines) | stat: -rw-r--r-- 1,152 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
! { dg-do compile }
! { dg-options "-Wall" }

! PR 57022: [4.7/4.8/4.9 Regression] Inappropriate warning for use of TRANSFER with arrays
! Contributed by William Clodius <wclodius@los-alamos.net>

subroutine transfers (test)

  use, intrinsic :: iso_fortran_env
  
  integer, intent(in) :: test

  integer(int8)  :: test8(8)  = 0
  integer(int16) :: test16(4) = 0
  integer(int32) :: test32(2) = 0
  integer(int64) :: test64    = 0

  select case(test)
  case(0)
    test64 = transfer(test8, test64)
  case(1)
    test64 = transfer(test16, test64)
  case(2)
    test64 = transfer(test32, test64)
  case(3)
    test8  = transfer(test64, test8, 8)
  case(4)
    test16 = transfer(test64, test16, 4)
  case(5)
    test32 = transfer(test64, test32, 2)
  end select

end subroutine


! PR 53685: surprising warns about transfer with explicit character range
! Contributed by Jos de Kloe <kloedej@knmi.nl>

subroutine mytest(byte_array,val)
  integer, parameter :: r8_ = Selected_Real_Kind(15,307)  ! = real*8
  character(len=1), dimension(16), intent(in) :: byte_array
  real(r8_),intent(out) :: val
  val = transfer(byte_array(1:8),val)    
end subroutine