OSDN Git Service

PR testsuite/51875
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / derived_constructor_char_1.f90
1 ! { dg-do compile }
2 ! { dg-options "-fdump-tree-original" }
3 !
4 ! PR fortran/44857
5 !
6 !
7   Type :: t5
8     character (len=5) :: txt(4)
9   End Type t5
10
11   character (len=3), parameter :: str3(2) = [ "ABC", "ZYX" ]
12   character (len=5), parameter :: str5(2) = [ "AbCdE", "ZyXwV" ]
13   character (len=5), parameter :: str7(2) = [ "aBcDeFg", "zYxWvUt" ]
14
15   Type (t5) :: one   = t5((/ "12345", "67890" /))
16   Type (t5) :: two   = t5((/ "123", "678" /))
17   Type (t5) :: three = t5((/ "1234567", "abcdefg" /))
18   Type (t5) :: four  = t5(str3)
19   Type (t5) :: five  = t5(str5)
20   Type (t5) :: six  = t5(str7)
21   print '(2a)', one, two, three, four, five, six
22 End
23
24 subroutine wasICEing()
25   implicit none
26
27   Type :: Err_Text_Type
28     integer :: nlines
29     character (len=132), dimension(5) :: txt
30   End Type Err_Text_Type
31
32   Type (Err_Text_Type)  :: Mess_FindFMT =  &
33                                 Err_Text_Type(0, (/" "," "," "," "," "/))
34 end subroutine wasICEing
35
36 subroutine anotherCheck()
37   Type :: t
38     character (len=3) :: txt(2)
39   End Type
40   Type (t) :: tt = t((/ character(len=5) :: "12345", "67890" /))
41   print *, tt
42 end subroutine
43
44 ! { dg-final { scan-tree-dump-times "one = ..txt=..12345., .67890...;" 1 "original" } }
45 ! { dg-final { scan-tree-dump-times "two = ..txt=..123  ., .678  ...;" 1 "original" } }
46 ! { dg-final { scan-tree-dump-times "three = ..txt=..12345., .abcde...;" 1 "original" } }
47 ! { dg-final { scan-tree-dump-times "four = ..txt=..ABC  ., .ZYX  ...;" 1 "original" } }
48 ! { dg-final { scan-tree-dump-times "five = ..txt=..AbCdE., .ZyXwV...;" 1 "original" } }
49 ! { dg-final { scan-tree-dump-times "six = ..txt=..aBcDe., .zYxWv...;" 1 "original" } }
50 ! { dg-final { cleanup-tree-dump "original" } }