aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/unreferenced_use_assoc_1.f90
blob: 1f36b2d12d9ff4b691166754ddfbf42fc52a86d3 (plain)
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
! { dg-do compile }
! Tests the  fix for PR31424.
!
module InternalCompilerError

   type Byte
      private 
      character(len=1)     :: singleByte
   end type

   type (Byte)             :: BytesPrototype(1)

   type UserType
      real :: r
   end type

contains

   function UserTypeToBytes(user) result (bytes) 
      type(UserType) :: user 
      type(Byte)     :: bytes(size(transfer(user, BytesPrototype)))
      bytes = transfer(user, BytesPrototype) 
   end function

   subroutine DoSomethingWithBytes(bytes)
      type(Byte), intent(in)     :: bytes(:)
   end subroutine

end module


program main
   use InternalCompilerError
   type (UserType) :: user 

   ! The following line caused the ICE 
   call DoSomethingWithBytes( UserTypeToBytes(user) )

end program