Files
TheRock/compiler/amd-llvm/clang/test/DebugInfo/Generic/cfi-icall-generalize-debuginfo.c
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

139 lines
12 KiB
C

// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5
// RUN: %clang_cc1 -triple x86_64-unknown-linux -O2 -fsanitize=cfi-icall -fsanitize-trap=cfi-icall -emit-llvm -o - %s \
// RUN: -fsanitize-annotate-debug-info=cfi-icall,cfi-nvcall,cfi-vcall,cfi-unrelated-cast,cfi-derived-cast \
// RUN: -fdebug-prefix-map=%S/= -fno-ident -fdebug-compilation-dir=%S -debug-info-kind=limited \
// RUN: | FileCheck --check-prefix=CHECK --check-prefix=UNGENERALIZED %s
//
// RUN: %clang_cc1 -triple x86_64-unknown-linux -O2 -fsanitize=cfi-icall -fsanitize-trap=cfi-icall -fsanitize-cfi-icall-generalize-pointers -emit-llvm -o - %s \
// RUN: -fsanitize-annotate-debug-info=cfi-icall,cfi-nvcall,cfi-vcall,cfi-unrelated-cast,cfi-derived-cast \
// RUN: -fdebug-prefix-map=%S/= -fno-ident -fdebug-compilation-dir=%S -debug-info-kind=limited \
// RUN: | FileCheck --check-prefix=CHECK --check-prefix=GENERALIZED %s
// Test that const char* is generalized to const ptr and that const char** is
// generalized to ptr
// CHECK-LABEL: define dso_local noalias noundef ptr @f(
// CHECK-SAME: ptr noundef readnone captures(none) [[A:%.*]], ptr noundef readnone captures(none) [[B:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] !dbg [[DBG14:![0-9]+]] !type [[META25:![0-9]+]] !type [[META26:![0-9]+]] {
// CHECK-NEXT: [[ENTRY:.*:]]
// CHECK-NEXT: #dbg_value(ptr [[A]], [[META23:![0-9]+]], !DIExpression(), [[META27:![0-9]+]])
// CHECK-NEXT: #dbg_value(ptr [[B]], [[META24:![0-9]+]], !DIExpression(), [[META27]])
// CHECK-NEXT: ret ptr null, !dbg [[DBG28:![0-9]+]]
//
int** f(const char *a, const char **b) {
return (int**)0;
}
// UNGENERALIZED-LABEL: define dso_local void @g(
// UNGENERALIZED-SAME: ptr noundef [[FP:%.*]]) local_unnamed_addr #[[ATTR1:[0-9]+]] !dbg [[DBG29:![0-9]+]] !type [[META35:![0-9]+]] !type [[META36:![0-9]+]] {
// UNGENERALIZED-NEXT: [[ENTRY:.*:]]
// UNGENERALIZED-NEXT: #dbg_value(ptr [[FP]], [[META34:![0-9]+]], !DIExpression(), [[META37:![0-9]+]])
// UNGENERALIZED-NEXT: [[TMP0:%.*]] = tail call i1 @llvm.type.test(ptr [[FP]], metadata !"_ZTSFPPiPKcPS2_E"), !dbg [[DBG38:![0-9]+]], !nosanitize [[META43:![0-9]+]]
// UNGENERALIZED-NEXT: br i1 [[TMP0]], label %[[CONT:.*]], label %[[TRAP:.*]], !dbg [[DBG38]], !prof [[PROF44:![0-9]+]], !nosanitize [[META43]]
// UNGENERALIZED: [[TRAP]]:
// UNGENERALIZED-NEXT: tail call void @llvm.ubsantrap(i8 2) #[[ATTR4:[0-9]+]], !dbg [[DBG45:![0-9]+]], !nosanitize [[META43]]
// UNGENERALIZED-NEXT: unreachable, !dbg [[DBG45]], !nosanitize [[META43]]
// UNGENERALIZED: [[CONT]]:
// UNGENERALIZED-NEXT: [[CALL:%.*]] = tail call ptr [[FP]](ptr noundef null, ptr noundef null) #[[ATTR5:[0-9]+]], !dbg [[DBG42:![0-9]+]]
// UNGENERALIZED-NEXT: ret void, !dbg [[DBG47:![0-9]+]]
//
// GENERALIZED-LABEL: define dso_local void @g(
// GENERALIZED-SAME: ptr noundef [[FP:%.*]]) local_unnamed_addr #[[ATTR1:[0-9]+]] !dbg [[DBG29:![0-9]+]] !type [[META35:![0-9]+]] !type [[META36:![0-9]+]] {
// GENERALIZED-NEXT: [[ENTRY:.*:]]
// GENERALIZED-NEXT: #dbg_value(ptr [[FP]], [[META34:![0-9]+]], !DIExpression(), [[META37:![0-9]+]])
// GENERALIZED-NEXT: [[TMP0:%.*]] = tail call i1 @llvm.type.test(ptr [[FP]], metadata !"_ZTSFPvPKvS_E.generalized"), !dbg [[DBG38:![0-9]+]], !nosanitize [[META43:![0-9]+]]
// GENERALIZED-NEXT: br i1 [[TMP0]], label %[[CONT:.*]], label %[[TRAP:.*]], !dbg [[DBG38]], !prof [[PROF44:![0-9]+]], !nosanitize [[META43]]
// GENERALIZED: [[TRAP]]:
// GENERALIZED-NEXT: tail call void @llvm.ubsantrap(i8 2) #[[ATTR4:[0-9]+]], !dbg [[DBG45:![0-9]+]], !nosanitize [[META43]]
// GENERALIZED-NEXT: unreachable, !dbg [[DBG45]], !nosanitize [[META43]]
// GENERALIZED: [[CONT]]:
// GENERALIZED-NEXT: [[CALL:%.*]] = tail call ptr [[FP]](ptr noundef null, ptr noundef null) #[[ATTR5:[0-9]+]], !dbg [[DBG42:![0-9]+]]
// GENERALIZED-NEXT: ret void, !dbg [[DBG47:![0-9]+]]
//
void g(int** (*fp)(const char *, const char **)) {
fp(0, 0);
}
//.
// UNGENERALIZED: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C11, file: [[META1:![0-9]+]], isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, retainedTypes: [[META2:![0-9]+]], splitDebugInlining: false, nameTableKind: None)
// UNGENERALIZED: [[META1]] = !DIFile(filename: "{{.*}}<stdin>", directory: {{.*}})
// UNGENERALIZED: [[META2]] = !{[[META3:![0-9]+]]}
// UNGENERALIZED: [[META3]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META4:![0-9]+]], size: 64)
// UNGENERALIZED: [[META4]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META5:![0-9]+]], size: 64)
// UNGENERALIZED: [[META5]] = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
// UNGENERALIZED: [[DBG14]] = distinct !DISubprogram(name: "f", scope: [[META15:![0-9]+]], file: [[META15]], line: 22, type: [[META16:![0-9]+]], scopeLine: 22, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META0]], retainedNodes: [[META22:![0-9]+]])
// UNGENERALIZED: [[META15]] = !DIFile(filename: "cfi-icall-generalize-debuginfo.c", directory: "")
// UNGENERALIZED: [[META16]] = !DISubroutineType(types: [[META17:![0-9]+]])
// UNGENERALIZED: [[META17]] = !{[[META3]], [[META18:![0-9]+]], [[META21:![0-9]+]]}
// UNGENERALIZED: [[META18]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META19:![0-9]+]], size: 64)
// UNGENERALIZED: [[META19]] = !DIDerivedType(tag: DW_TAG_const_type, baseType: [[META20:![0-9]+]])
// UNGENERALIZED: [[META20]] = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
// UNGENERALIZED: [[META21]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META18]], size: 64)
// UNGENERALIZED: [[META22]] = !{[[META23]], [[META24]]}
// UNGENERALIZED: [[META23]] = !DILocalVariable(name: "a", arg: 1, scope: [[DBG14]], file: [[META15]], line: 22, type: [[META18]])
// UNGENERALIZED: [[META24]] = !DILocalVariable(name: "b", arg: 2, scope: [[DBG14]], file: [[META15]], line: 22, type: [[META21]])
// UNGENERALIZED: [[META25]] = !{i64 0, !"_ZTSFPPiPKcPS2_E"}
// UNGENERALIZED: [[META26]] = !{i64 0, !"_ZTSFPvPKvS_E.generalized"}
// UNGENERALIZED: [[META27]] = !DILocation(line: 0, scope: [[DBG14]])
// UNGENERALIZED: [[DBG28]] = !DILocation(line: 23, column: 3, scope: [[DBG14]])
// UNGENERALIZED: [[DBG29]] = distinct !DISubprogram(name: "g", scope: [[META15]], file: [[META15]], line: 52, type: [[META30:![0-9]+]], scopeLine: 52, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META0]], retainedNodes: [[META33:![0-9]+]])
// UNGENERALIZED: [[META30]] = !DISubroutineType(types: [[META31:![0-9]+]])
// UNGENERALIZED: [[META31]] = !{null, [[META32:![0-9]+]]}
// UNGENERALIZED: [[META32]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META16]], size: 64)
// UNGENERALIZED: [[META33]] = !{[[META34]]}
// UNGENERALIZED: [[META34]] = !DILocalVariable(name: "fp", arg: 1, scope: [[DBG29]], file: [[META15]], line: 52, type: [[META32]])
// UNGENERALIZED: [[META35]] = !{i64 0, !"_ZTSFvPFPPiPKcPS2_EE"}
// UNGENERALIZED: [[META36]] = !{i64 0, !"_ZTSFvPvE.generalized"}
// UNGENERALIZED: [[META37]] = !DILocation(line: 0, scope: [[DBG29]])
// UNGENERALIZED: [[DBG38]] = !DILocation(line: 0, scope: [[META39:![0-9]+]], inlinedAt: [[DBG42]])
// UNGENERALIZED: [[META39]] = distinct !DISubprogram(name: "__ubsan_check_cfi_icall", scope: [[META40:![0-9]+]], file: [[META40]], type: [[META41:![0-9]+]], flags: DIFlagArtificial, spFlags: DISPFlagDefinition, unit: [[META0]])
// UNGENERALIZED: [[META40]] = !DIFile(filename: "{{.*}}ubsan_interface.h", directory: {{.*}})
// UNGENERALIZED: [[META41]] = !DISubroutineType(types: null)
// UNGENERALIZED: [[DBG42]] = !DILocation(line: 53, column: 3, scope: [[DBG29]])
// UNGENERALIZED: [[META43]] = !{}
// UNGENERALIZED: [[PROF44]] = !{!"branch_weights", i32 1048575, i32 1}
// UNGENERALIZED: [[DBG45]] = !DILocation(line: 0, scope: [[META46:![0-9]+]], inlinedAt: [[DBG38]])
// UNGENERALIZED: [[META46]] = distinct !DISubprogram(name: "__clang_trap_msg$Undefined Behavior Sanitizer$Control flow integrity check failed", scope: [[META40]], file: [[META40]], type: [[META41]], flags: DIFlagArtificial, spFlags: DISPFlagDefinition, unit: [[META0]])
// UNGENERALIZED: [[DBG47]] = !DILocation(line: 54, column: 1, scope: [[DBG29]])
//.
// GENERALIZED: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C11, file: [[META1:![0-9]+]], isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, retainedTypes: [[META2:![0-9]+]], splitDebugInlining: false, nameTableKind: None)
// GENERALIZED: [[META1]] = !DIFile(filename: "{{.*}}<stdin>", directory: {{.*}})
// GENERALIZED: [[META2]] = !{[[META3:![0-9]+]]}
// GENERALIZED: [[META3]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META4:![0-9]+]], size: 64)
// GENERALIZED: [[META4]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META5:![0-9]+]], size: 64)
// GENERALIZED: [[META5]] = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
// GENERALIZED: [[DBG14]] = distinct !DISubprogram(name: "f", scope: [[META15:![0-9]+]], file: [[META15]], line: 22, type: [[META16:![0-9]+]], scopeLine: 22, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META0]], retainedNodes: [[META22:![0-9]+]])
// GENERALIZED: [[META15]] = !DIFile(filename: "cfi-icall-generalize-debuginfo.c", directory: "")
// GENERALIZED: [[META16]] = !DISubroutineType(types: [[META17:![0-9]+]])
// GENERALIZED: [[META17]] = !{[[META3]], [[META18:![0-9]+]], [[META21:![0-9]+]]}
// GENERALIZED: [[META18]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META19:![0-9]+]], size: 64)
// GENERALIZED: [[META19]] = !DIDerivedType(tag: DW_TAG_const_type, baseType: [[META20:![0-9]+]])
// GENERALIZED: [[META20]] = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
// GENERALIZED: [[META21]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META18]], size: 64)
// GENERALIZED: [[META22]] = !{[[META23]], [[META24]]}
// GENERALIZED: [[META23]] = !DILocalVariable(name: "a", arg: 1, scope: [[DBG14]], file: [[META15]], line: 22, type: [[META18]])
// GENERALIZED: [[META24]] = !DILocalVariable(name: "b", arg: 2, scope: [[DBG14]], file: [[META15]], line: 22, type: [[META21]])
// GENERALIZED: [[META25]] = !{i64 0, !"_ZTSFPPiPKcPS2_E"}
// GENERALIZED: [[META26]] = !{i64 0, !"_ZTSFPvPKvS_E.generalized"}
// GENERALIZED: [[META27]] = !DILocation(line: 0, scope: [[DBG14]])
// GENERALIZED: [[DBG28]] = !DILocation(line: 23, column: 3, scope: [[DBG14]])
// GENERALIZED: [[DBG29]] = distinct !DISubprogram(name: "g", scope: [[META15]], file: [[META15]], line: 52, type: [[META30:![0-9]+]], scopeLine: 52, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META0]], retainedNodes: [[META33:![0-9]+]])
// GENERALIZED: [[META30]] = !DISubroutineType(types: [[META31:![0-9]+]])
// GENERALIZED: [[META31]] = !{null, [[META32:![0-9]+]]}
// GENERALIZED: [[META32]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META16]], size: 64)
// GENERALIZED: [[META33]] = !{[[META34]]}
// GENERALIZED: [[META34]] = !DILocalVariable(name: "fp", arg: 1, scope: [[DBG29]], file: [[META15]], line: 52, type: [[META32]])
// GENERALIZED: [[META35]] = !{i64 0, !"_ZTSFvPFPPiPKcPS2_EE"}
// GENERALIZED: [[META36]] = !{i64 0, !"_ZTSFvPvE.generalized"}
// GENERALIZED: [[META37]] = !DILocation(line: 0, scope: [[DBG29]])
// GENERALIZED: [[DBG38]] = !DILocation(line: 0, scope: [[META39:![0-9]+]], inlinedAt: [[DBG42]])
// GENERALIZED: [[META39]] = distinct !DISubprogram(name: "__ubsan_check_cfi_icall", scope: [[META40:![0-9]+]], file: [[META40]], type: [[META41:![0-9]+]], flags: DIFlagArtificial, spFlags: DISPFlagDefinition, unit: [[META0]])
// GENERALIZED: [[META40]] = !DIFile(filename: "{{.*}}ubsan_interface.h", directory: {{.*}})
// GENERALIZED: [[META41]] = !DISubroutineType(types: null)
// GENERALIZED: [[DBG42]] = !DILocation(line: 53, column: 3, scope: [[DBG29]])
// GENERALIZED: [[META43]] = !{}
// GENERALIZED: [[PROF44]] = !{!"branch_weights", i32 1048575, i32 1}
// GENERALIZED: [[DBG45]] = !DILocation(line: 0, scope: [[META46:![0-9]+]], inlinedAt: [[DBG38]])
// GENERALIZED: [[META46]] = distinct !DISubprogram(name: "__clang_trap_msg$Undefined Behavior Sanitizer$Control flow integrity check failed", scope: [[META40]], file: [[META40]], type: [[META41]], flags: DIFlagArtificial, spFlags: DISPFlagDefinition, unit: [[META0]])
// GENERALIZED: [[DBG47]] = !DILocation(line: 54, column: 1, scope: [[DBG29]])
//.