summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/derived_constructor_comps_2.f90
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/derived_constructor_comps_2.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/derived_constructor_comps_2.f9027
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/derived_constructor_comps_2.f90 b/gcc/testsuite/gfortran.dg/derived_constructor_comps_2.f90
new file mode 100644
index 000000000..ef3005da2
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/derived_constructor_comps_2.f90
@@ -0,0 +1,27 @@
+! { dg-do compile }
+! Tests fix for PR29115, in which an ICE would be produced by
+! non-pointer elements being supplied to the pointer components
+! in a derived type constructor.
+!
+! Contributed by Paul Thomas <pault@gcc.gnu.org>
+!
+ type :: homer
+ integer, pointer :: bart(:)
+ end type homer
+ type(homer) :: marge
+ integer :: duff_beer
+ marge = homer (duff_beer) ! { dg-error "should be a POINTER or a TARGET" }
+end
+
+!
+! The following yield an ICE, see PR 34083
+!
+subroutine foo
+ type ByteType
+ character(len=1) :: singleByte
+ end type
+ type (ByteType) :: bytes(4)
+
+ print *, size(bytes)
+ bytes = ByteType((/'H', 'i', '!', ' '/)) ! { dg-error "rank of the element in the derived type constructor" }
+end subroutine foo