aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/used_dummy_types_1.f90
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/used_dummy_types_1.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/used_dummy_types_1.f9036
1 files changed, 36 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/used_dummy_types_1.f90 b/gcc/testsuite/gfortran.dg/used_dummy_types_1.f90
new file mode 100644
index 00000000000..9d034a680da
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/used_dummy_types_1.f90
@@ -0,0 +1,36 @@
+! { dg-do run }
+! This checks the fix for PR20244 in which USE association
+! of derived types would cause an ICE, if the derived type
+! was also available by host association. This occurred
+! because the backend declarations were different.
+!
+! Contributed by Paul Thomas <pault@gcc.gnu.org>
+!==============
+module mtyp
+ type t1
+ integer::a
+ end type t1
+end module mtyp
+!==============
+module atest
+ use mtyp
+ type(t1)::ze
+contains
+ subroutine test(ze_in )
+ use mtyp
+ implicit none
+ type(t1)::ze_in
+ ze_in = ze
+ end subroutine test
+ subroutine init( )
+ implicit none
+ ze = t1 (42)
+ end subroutine init
+end module atest
+!==============
+ use atest
+ type(t1) :: res = t1 (0)
+ call init ()
+ call test (res)
+ if (res%a.ne.42) call abort
+end \ No newline at end of file