summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/impure_assignment_1.f90
blob: 6a1660c38e986e358e1a269e5f8a12eccfd9ca8f (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
! { dg-do compile }
! Tests fix for PR25059, which gave and ICE after error message  
! Contributed by Joost VandeVondele  <jv244@cam.ac.uk>
MODULE M1
 TYPE T1
  INTEGER :: I
 END TYPE T1
 INTERFACE ASSIGNMENT(=)
   MODULE PROCEDURE S1
 END INTERFACE
CONTAINS
   SUBROUTINE S1(I,J)
     TYPE(T1), INTENT(OUT):: I
     TYPE(T1), INTENT(IN) :: J
     I%I=J%I**2
   END SUBROUTINE S1
END MODULE M1

USE M1
CONTAINS
PURE SUBROUTINE S2(I,J)
     TYPE(T1), INTENT(OUT):: I
     TYPE(T1), INTENT(IN) :: J
     I=J                      ! { dg-error "is not PURE" }
END SUBROUTINE S2
END
! { dg-final { cleanup-modules "M1" } }