File: transfer_check_4.f90

package info (click to toggle)
gcc-arm-none-eabi 15%3A12.2.rel1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 959,712 kB
  • sloc: cpp: 3,275,382; ansic: 2,061,766; ada: 840,956; f90: 208,513; makefile: 76,132; asm: 73,433; xml: 50,448; exp: 34,146; sh: 32,436; objc: 15,637; fortran: 14,012; python: 11,991; pascal: 6,787; awk: 4,779; perl: 3,054; yacc: 338; ml: 285; lex: 201; haskell: 122
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