aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/assumed_type_3.f90
diff options
context:
space:
mode:
authorBen Cheng <bccheng@google.com>2014-03-25 22:37:19 -0700
committerBen Cheng <bccheng@google.com>2014-03-25 22:37:19 -0700
commit1bc5aee63eb72b341f506ad058502cd0361f0d10 (patch)
treec607e8252f3405424ff15bc2d00aa38dadbb2518 /gcc-4.9/gcc/testsuite/gfortran.dg/assumed_type_3.f90
parent283a0bf58fcf333c58a2a92c3ebbc41fb9eb1fdb (diff)
downloadtoolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.gz
toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.bz2
toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.zip
Initial checkin of GCC 4.9.0 from trunk (r208799).
Change-Id: I48a3c08bb98542aa215912a75f03c0890e497dba
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gfortran.dg/assumed_type_3.f90')
-rw-r--r--gcc-4.9/gcc/testsuite/gfortran.dg/assumed_type_3.f90119
1 files changed, 119 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gfortran.dg/assumed_type_3.f90 b/gcc-4.9/gcc/testsuite/gfortran.dg/assumed_type_3.f90
new file mode 100644
index 000000000..e5bff509e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gfortran.dg/assumed_type_3.f90
@@ -0,0 +1,119 @@
+! { dg-do compile }
+! { dg-options "-fcoarray=single" }
+!
+! PR fortran/48820
+!
+! Test TYPE(*)
+
+subroutine one(a) ! { dg-error "may not have the ALLOCATABLE, CODIMENSION, POINTER or VALUE attribute" }
+ type(*), value :: a
+end subroutine one
+
+subroutine two(a) ! { dg-error "may not have the ALLOCATABLE, CODIMENSION, POINTER or VALUE attribute" }
+ type(*), pointer :: a
+end subroutine two
+
+subroutine three(a) ! { dg-error "may not have the ALLOCATABLE, CODIMENSION, POINTER or VALUE attribute" }
+ type(*), allocatable :: a
+end subroutine three
+
+subroutine four(a) ! { dg-error "may not have the ALLOCATABLE, CODIMENSION, POINTER or VALUE attribute" }
+ type(*) :: a[*]
+end subroutine four
+
+subroutine five(a) ! { dg-error "shall not be an explicit-shape array" }
+ type(*) :: a(3)
+end subroutine five
+
+subroutine six()
+ type(*) :: nodum ! { dg-error "is only permitted for dummy variables" }
+end subroutine six
+
+subroutine seven(y)
+ type(*) :: y(:)
+ call a7(y(3:5)) ! { dg-error "Assumed-type variable y at .1. shall not have a subobject reference" }
+contains
+ subroutine a7(x)
+ type(*) :: x(*)
+ end subroutine a7
+end subroutine seven
+
+subroutine eight()
+ type t
+ type(*) :: x ! { dg-error "is not allowed for components" }
+ end type t
+end subroutine eight
+
+subroutine nine()
+ interface one
+ subroutine okay(x)
+ type(*) :: x
+ end subroutine okay
+ subroutine okay2(x)
+ type(*) :: x(*)
+ end subroutine okay2
+ subroutine okay3(x,y)
+ integer :: x
+ type(*) :: y
+ end subroutine okay3
+ end interface
+ interface two
+ subroutine okok1(x)
+ type(*) :: x
+ end subroutine okok1
+ subroutine okok2(x)
+ integer :: x(*)
+ end subroutine okok2
+ end interface
+ interface three
+ subroutine ambig1(x)
+ type(*) :: x
+ end subroutine ambig1
+ subroutine ambig2(x)
+ integer :: x
+ end subroutine ambig2 ! { dg-error "Ambiguous interfaces 'ambig2' and 'ambig1' in generic interface 'three'" }
+ end interface
+end subroutine nine
+
+subroutine ten()
+ interface
+ subroutine bar()
+ end subroutine
+ end interface
+ type t
+ contains
+ procedure, nopass :: proc => bar
+ end type
+ type(t) :: xx
+ call sub(xx) ! { dg-error "is of derived type with type-bound or FINAL procedures" }
+contains
+ subroutine sub(a)
+ type(*) :: a
+ end subroutine sub
+end subroutine ten
+
+subroutine eleven(x)
+ external bar
+ type(*) :: x
+ call bar(x) ! { dg-error "Assumed-type argument x at .1. requires an explicit interface" }
+end subroutine eleven
+
+subroutine twelf(x)
+ type(*) :: x
+ call bar(x) ! { dg-error "Type mismatch in argument" }
+contains
+ subroutine bar(x)
+ integer :: x
+ end subroutine bar
+end subroutine twelf
+
+subroutine thirteen(x, y)
+ type(*) :: x
+ integer :: y(:)
+ print *, ubound(y, dim=x) ! { dg-error "Assumed-type argument at .1. is only permitted as first actual argument to the intrinsic ubound" }
+end subroutine thirteen
+
+subroutine fourteen(x)
+ type(*) :: x
+ x = x ! { dg-error "Assumed-type variable x at .1. may only be used as actual argument" }
+end subroutine fourteen