summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/unreferenced_use_assoc_1.f90
blob: 57892d5328f8a9784acbb20e1bc209f0ff0c582e (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
40
! { 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 
! { dg-final { cleanup-modules "InternalCompilerError" } }