xref: /llvm-project/flang/test/Integration/debug-char-type-1.f90 (revision 3a57925b071f16c64af6a729078dce58510a0da9)
1! RUN: %flang_fc1 -emit-llvm -debug-info-kind=standalone %s -o - | FileCheck  %s
2
3module helper
4  character(len=40) :: str
5  character(len=:), allocatable :: str2
6end module helper
7
8program test
9  use helper
10  character(kind=4, len=8) :: first
11  character(len=10) :: second
12  first = '3.14 = π'
13  second = 'Fortran'
14  str = 'Hello World!'
15  str2 = 'A quick brown fox jumps over a lazy dog'
16end program test
17
18! CHECK-DAG: !DIGlobalVariable(name: "str"{{.*}}type: ![[TY40:[0-9]+]]{{.*}})
19! CHECK-DAG: ![[TY40]] = !DIStringType(size: 320, encoding: DW_ATE_ASCII)
20! CHECK-DAG: !DIGlobalVariable(name: "str2"{{.*}}type: ![[TY:[0-9]+]]{{.*}})
21! CHECK-DAG: ![[TY]] = !DIStringType(stringLengthExpression: !DIExpression(DW_OP_push_object_address, DW_OP_plus_uconst, 8), stringLocationExpression: !DIExpression(DW_OP_push_object_address, DW_OP_deref), encoding: DW_ATE_ASCII)
22! CHECK-DAG: !DILocalVariable(name: "first"{{.*}}type: ![[TY8:[0-9]+]])
23! CHECK-DAG: ![[TY8]] = !DIStringType(size: 256, encoding: DW_ATE_UCS)
24! CHECK-DAG: !DILocalVariable(name: "second"{{.*}}type: ![[TY10:[0-9]+]])
25! CHECK-DAG: ![[TY10]] = !DIStringType(size: 80, encoding: DW_ATE_ASCII)
26