fix pr/45972
[official-gcc.git] / gcc / testsuite / gfortran.dg / unreferenced_use_assoc_1.f90
blob57892d5328f8a9784acbb20e1bc209f0ff0c582e
1 ! { dg-do compile }
2 ! Tests the fix for PR31424.
4 module InternalCompilerError
6 type Byte
7 private
8 character(len=1) :: singleByte
9 end type
11 type (Byte) :: BytesPrototype(1)
13 type UserType
14 real :: r
15 end type
17 contains
19 function UserTypeToBytes(user) result (bytes)
20 type(UserType) :: user
21 type(Byte) :: bytes(size(transfer(user, BytesPrototype)))
22 bytes = transfer(user, BytesPrototype)
23 end function
25 subroutine DoSomethingWithBytes(bytes)
26 type(Byte), intent(in) :: bytes(:)
27 end subroutine
29 end module
32 program main
33 use InternalCompilerError
34 type (UserType) :: user
36 ! The following line caused the ICE
37 call DoSomethingWithBytes( UserTypeToBytes(user) )
39 end program
40 ! { dg-final { cleanup-modules "InternalCompilerError" } }