diff options
Diffstat (limited to 'gcc/testsuite/gfortran.dg/string_pad_trunc.f90')
-rw-r--r-- | gcc/testsuite/gfortran.dg/string_pad_trunc.f90 | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/string_pad_trunc.f90 b/gcc/testsuite/gfortran.dg/string_pad_trunc.f90 new file mode 100644 index 000000000..738a181b9 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/string_pad_trunc.f90 @@ -0,0 +1,20 @@ +! { dg-do run } +! PR20713. Pad and truncate string. + +character(len = 6),parameter:: a = 'hello' +character(len = 6),parameter:: b = 'hello *' +character(len = 6),parameter:: c (1:1) = 'hello' +character(len = 11) line + +write (line, '(6A)') a, 'world' +if (line .ne. 'hello world') call abort + +write (line, '(6A)') b, 'world' +if (line .ne. 'hello world') call abort + +write (line, '(6A)') c, 'world' +if (line .ne. 'hello world') call abort + +write (line, '(6A)') c(1), 'world' +if (line .ne. 'hello world') call abort +end |