c: Fix up pointer types to may_alias structures [PR114493]
[official-gcc.git] / gcc / testsuite / gfortran.dg / char4-subscript.f90
blobb4e2d11d6c5fc55f88fa4b99bcf1878cc3c2612b
1 ! { dg-do run }
2 ! { dg-additional-options "-fdump-tree-original" }
4 ! PR fortran/95837
6 type t
7 character(len=:, kind=4), pointer :: str2
8 end type t
9 type(t) :: var
11 allocate(character(len=5, kind=4) :: var%str2)
13 var%str2(1:1) = 4_"d"
14 var%str2(2:3) = 4_"ef"
15 var%str2(4:4) = achar(int(Z'1F600'), kind=4)
16 var%str2(5:5) = achar(int(Z'1F608'), kind=4)
18 if (var%str2(1:3) /= 4_"def") stop 1
19 if (ichar(var%str2(4:4)) /= int(Z'1F600')) stop 2
20 if (ichar(var%str2(5:5)) /= int(Z'1F608')) stop 2
22 deallocate(var%str2)
23 end
25 ! Note: the last '\x00' is regarded as string terminator, hence, the trailing \0 byte is not in the dump
27 ! { dg-final { scan-tree-dump { \(\*var\.str2\)\[1\]{lb: 1 sz: 4} = "(d\\x00\\x00|\\x00\\x00\\x00d)"\[1\]{lb: 1 sz: 4};} "original" } }
28 ! { dg-final { scan-tree-dump { __builtin_memmove \(\(void \*\) &\(\*var.str2\)\[2\]{lb: 1 sz: 4}, \(void \*\) &"(e\\x00\\x00\\x00f\\x00\\x00|\\x00\\x00\\x00e\\x00\\x00\\x00f)"\[1\]{lb: 1 sz: 4}, 8\);} "original" } }
29 ! { dg-final { scan-tree-dump { \(\*var.str2\)\[4\]{lb: 1 sz: 4} = "(\\x00\\xf6\\x01|\\x00\\x01\\xf6)"\[1\]{lb: 1 sz: 4};} "original" } }
30 ! { dg-final { scan-tree-dump { \(\*var.str2\)\[5\]{lb: 1 sz: 4} = "(\\b\\xf6\\x01|\\x00\\x01\\xf6\\b)"\[1\]{lb: 1 sz: 4};} "original" } }