summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/char_cons_len.f90
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/char_cons_len.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/char_cons_len.f9017
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/char_cons_len.f90 b/gcc/testsuite/gfortran.dg/char_cons_len.f90
new file mode 100644
index 000000000..cf920bdfb
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/char_cons_len.f90
@@ -0,0 +1,17 @@
+! { dg-do compile }
+! Tests the fix for PR24813 in which a character array
+! constructor, as an argument for LEN, would cause an ICE.
+!
+ character(11) :: chr1, chr2
+ i = len ((/chr1, chr2, "ggg "/))
+ j = len ((/"abcdefghijk", chr1, chr2/))
+ k = len ((/'hello ','goodbye'/))
+ l = foo ("yes siree, Bob")
+ if (any ((/11,11,7,14/) /= (/i,j,k,l/))) call abort ()
+contains
+ integer function foo (arg)
+ character(*) :: arg
+ character(len(arg)) :: ctor
+ foo = len ((/ctor/))
+ end function foo
+end