aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/alloc_comp_assign_9.f90
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/alloc_comp_assign_9.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/alloc_comp_assign_9.f9020
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/alloc_comp_assign_9.f90 b/gcc/testsuite/gfortran.dg/alloc_comp_assign_9.f90
new file mode 100644
index 00000000000..9051bafa019
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/alloc_comp_assign_9.f90
@@ -0,0 +1,20 @@
+! { dg-do run }
+! Test the fix for PR39519, where the presence of the pointer
+! as the first component was preventing the second from passing
+! the "alloc_comp" attribute to the derived type.
+!
+! Contributed by Gilbert Scott <gilbert.scott@easynet.co.uk>
+!
+PROGRAM X
+ TYPE T
+ INTEGER, POINTER :: P
+ INTEGER, ALLOCATABLE :: A(:)
+ END TYPE T
+ TYPE(T) :: T1,T2
+ ALLOCATE ( T1%A(1) )
+ ALLOCATE ( T2%A(1) )
+ T1%A = 23
+ T2 = T1
+ T1%A = 42
+ if (T2%A(1) .NE. 23) CALL ABORT
+END PROGRAM X