summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_len.f90
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_len.f90')
-rw-r--r--gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_len.f9022
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_len.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_len.f90
new file mode 100644
index 00000000000..6721738608f
--- /dev/null
+++ b/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_len.f90
@@ -0,0 +1,22 @@
+! Program to test the LEN intrinsic
+program test
+ character(len=10) a
+ character(len=8) w
+ type person
+ character(len=10) name
+ integer age
+ end type person
+ type(person) Tom
+ integer n
+ a = w (n)
+
+ if ((a .ne. "01234567") .or. (n .ne. 8)) call abort
+ if (len(Tom%name) .ne. 10) call abort
+end
+
+function w(i)
+ character(len=8) w
+ integer i
+ w = "01234567"
+ i = len(w)
+end