aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/deferred_character_18.f90
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/deferred_character_18.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/deferred_character_18.f9029
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/deferred_character_18.f90 b/gcc/testsuite/gfortran.dg/deferred_character_18.f90
new file mode 100644
index 00000000000..1b1457fa293
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/deferred_character_18.f90
@@ -0,0 +1,29 @@
+! { dg-do compile }
+! PR Fortran/82367
+! Contributed by Walter Spector <w6ws at earthlink dot net>
+module cls_allocmod
+ implicit none
+
+contains
+
+ subroutine cls_alloc (n, str)
+ integer, intent(in) :: n
+ character(*), allocatable, intent(out) :: str
+! Note: Star ^ should have been a colon (:)
+
+ allocate (character(n)::str)
+
+ end subroutine
+
+end module
+
+program cls
+ use cls_allocmod
+ implicit none
+
+ character(:), allocatable :: s
+
+ call cls_alloc(42, s) ! { dg-error "allocatable or pointer dummy argument" }
+ print *, 'string len =', len(s)
+
+end program