xref: /llvm-project/llvm/test/DebugInfo/Generic/DICommonBlock.ll (revision 5a288fa32e0c91b211e39f3e370255916902f898)
1; RUN: %llc_dwarf -O0 -filetype=obj < %s > %t
2; RUN: llvm-dwarfdump -debug-info %t | FileCheck %s
3; CHECK: DW_TAG_common_block
4; CHECK-DAG: DW_AT_name{{.*}}"a"
5; CHECK-DAG: DW_AT_location
6; CHECK: DW_TAG_variable
7; CHECK-DAG: DW_AT_name{{.*}}"c"
8; CHECK-DAG: DW_AT_location{{.*}}DW_OP_plus_uconst{{.*}}4
9; CHECK: {{DW_TAG|NULL}}
10
11target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
12
13@common_a = common global [32 x i8] zeroinitializer, align 8, !dbg !13, !dbg !15
14
15define i32 @subr() !dbg !9 {
16    %1 = getelementptr inbounds [32 x i8], ptr @common_a, i64 0, i32 8
17    %2 = load i32, ptr %1
18    ret i32 %2
19}
20
21!llvm.dbg.cu = !{!0}
22!llvm.module.flags = !{!6, !7}
23!llvm.ident = !{!8}
24
25!0 = distinct !DICompileUnit(language: DW_LANG_Fortran90, file: !1, producer: "PGI Fortran", isOptimized: false, runtimeVersion: 2, emissionKind: FullDebug, retainedTypes: !14, globals: !3)
26!1 = !DIFile(filename: "none.f90", directory: "/not/here/")
27!2 = distinct !DIGlobalVariable(scope: !5, name: "c", file: !1, type: !12, isDefinition: true)
28!3 = !{!13, !15}
29!4 = distinct !DIGlobalVariable(scope: !5, name: "COMMON /foo/", file: !1, line: 4, isLocal: false, isDefinition: true, type: !12)
30!5 = !DICommonBlock(scope: !9, declaration: !4, name: "a", file: !1, line: 4)
31!6 = !{i32 2, !"Dwarf Version", i32 4}
32!7 = !{i32 2, !"Debug Info Version", i32 3}
33!8 = !{!"PGI Fortran"}
34!9 = distinct !DISubprogram(name: "s", scope: !0, file: !1, line: 1, type: !10, isLocal: false, isDefinition: true, unit: !0)
35!10 = !DISubroutineType(types: !11)
36!11 = !{!12, !12}
37!12 = !DIBasicType(name: "int", size: 32)
38!13 = !DIGlobalVariableExpression(var: !4, expr: !DIExpression())
39!14 = !{!12, !10}
40!15 = !DIGlobalVariableExpression(var: !2, expr: !DIExpression(DW_OP_plus_uconst, 4))
41