Files
TheRock/compiler/amd-llvm/clang/test/DebugInfo/Generic/cfi-icall-normalize2-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

130 lines
10 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 -fsanitize-cfi-icall-experimental-normalize-integers -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 %s
// Test that normalized type metadata for functions are emitted for cross-language CFI support with
// other languages that can't represent and encode C/C++ integer types.
// CHECK-LABEL: define dso_local void @foo(
// CHECK-SAME: ptr noundef [[FN:%.*]], i32 noundef [[ARG:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] !dbg [[DBG11:![0-9]+]] !type [[META22:![0-9]+]] !type [[META23:![0-9]+]] {
// CHECK-NEXT: [[ENTRY:.*:]]
// CHECK-NEXT: #dbg_value(ptr [[FN]], [[META20:![0-9]+]], !DIExpression(), [[META24:![0-9]+]])
// CHECK-NEXT: #dbg_value(i32 [[ARG]], [[META21:![0-9]+]], !DIExpression(), [[META24]])
// CHECK-NEXT: [[TMP0:%.*]] = tail call i1 @llvm.type.test(ptr [[FN]], metadata !"_ZTSFvu3i32E.normalized"), !dbg [[DBG25:![0-9]+]], !nosanitize [[META30:![0-9]+]]
// CHECK-NEXT: br i1 [[TMP0]], label %[[CONT:.*]], label %[[TRAP:.*]], !dbg [[DBG25]], !prof [[PROF31:![0-9]+]], !nosanitize [[META30]]
// CHECK: [[TRAP]]:
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 2) #[[ATTR3:[0-9]+]], !dbg [[DBG32:![0-9]+]], !nosanitize [[META30]]
// CHECK-NEXT: unreachable, !dbg [[DBG32]], !nosanitize [[META30]]
// CHECK: [[CONT]]:
// CHECK-NEXT: tail call void [[FN]](i32 noundef [[ARG]]) #[[ATTR4:[0-9]+]], !dbg [[DBG29:![0-9]+]]
// CHECK-NEXT: ret void, !dbg [[DBG34:![0-9]+]]
//
void foo(void (*fn)(int), int arg) {
fn(arg);
}
// CHECK-LABEL: define dso_local void @bar(
// CHECK-SAME: ptr noundef [[FN:%.*]], i32 noundef [[ARG1:%.*]], i32 noundef [[ARG2:%.*]]) local_unnamed_addr #[[ATTR0]] !dbg [[DBG35:![0-9]+]] !type [[META45:![0-9]+]] !type [[META46:![0-9]+]] {
// CHECK-NEXT: [[ENTRY:.*:]]
// CHECK-NEXT: #dbg_value(ptr [[FN]], [[META42:![0-9]+]], !DIExpression(), [[META47:![0-9]+]])
// CHECK-NEXT: #dbg_value(i32 [[ARG1]], [[META43:![0-9]+]], !DIExpression(), [[META47]])
// CHECK-NEXT: #dbg_value(i32 [[ARG2]], [[META44:![0-9]+]], !DIExpression(), [[META47]])
// CHECK-NEXT: [[TMP0:%.*]] = tail call i1 @llvm.type.test(ptr [[FN]], metadata !"_ZTSFvu3i32S_E.normalized"), !dbg [[DBG48:![0-9]+]], !nosanitize [[META30]]
// CHECK-NEXT: br i1 [[TMP0]], label %[[CONT:.*]], label %[[TRAP:.*]], !dbg [[DBG48]], !prof [[PROF31]], !nosanitize [[META30]]
// CHECK: [[TRAP]]:
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 2) #[[ATTR3]], !dbg [[DBG50:![0-9]+]], !nosanitize [[META30]]
// CHECK-NEXT: unreachable, !dbg [[DBG50]], !nosanitize [[META30]]
// CHECK: [[CONT]]:
// CHECK-NEXT: tail call void [[FN]](i32 noundef [[ARG1]], i32 noundef [[ARG2]]) #[[ATTR4]], !dbg [[DBG49:![0-9]+]]
// CHECK-NEXT: ret void, !dbg [[DBG51:![0-9]+]]
//
void bar(void (*fn)(int, int), int arg1, int arg2) {
fn(arg1, arg2);
}
// CHECK-LABEL: define dso_local void @baz(
// CHECK-SAME: ptr noundef [[FN:%.*]], i32 noundef [[ARG1:%.*]], i32 noundef [[ARG2:%.*]], i32 noundef [[ARG3:%.*]]) local_unnamed_addr #[[ATTR0]] !dbg [[DBG52:![0-9]+]] !type [[META63:![0-9]+]] !type [[META64:![0-9]+]] {
// CHECK-NEXT: [[ENTRY:.*:]]
// CHECK-NEXT: #dbg_value(ptr [[FN]], [[META59:![0-9]+]], !DIExpression(), [[META65:![0-9]+]])
// CHECK-NEXT: #dbg_value(i32 [[ARG1]], [[META60:![0-9]+]], !DIExpression(), [[META65]])
// CHECK-NEXT: #dbg_value(i32 [[ARG2]], [[META61:![0-9]+]], !DIExpression(), [[META65]])
// CHECK-NEXT: #dbg_value(i32 [[ARG3]], [[META62:![0-9]+]], !DIExpression(), [[META65]])
// CHECK-NEXT: [[TMP0:%.*]] = tail call i1 @llvm.type.test(ptr [[FN]], metadata !"_ZTSFvu3i32S_S_E.normalized"), !dbg [[DBG66:![0-9]+]], !nosanitize [[META30]]
// CHECK-NEXT: br i1 [[TMP0]], label %[[CONT:.*]], label %[[TRAP:.*]], !dbg [[DBG66]], !prof [[PROF31]], !nosanitize [[META30]]
// CHECK: [[TRAP]]:
// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 2) #[[ATTR3]], !dbg [[DBG68:![0-9]+]], !nosanitize [[META30]]
// CHECK-NEXT: unreachable, !dbg [[DBG68]], !nosanitize [[META30]]
// CHECK: [[CONT]]:
// CHECK-NEXT: tail call void [[FN]](i32 noundef [[ARG1]], i32 noundef [[ARG2]], i32 noundef [[ARG3]]) #[[ATTR4]], !dbg [[DBG67:![0-9]+]]
// CHECK-NEXT: ret void, !dbg [[DBG69:![0-9]+]]
//
void baz(void (*fn)(int, int, int), int arg1, int arg2, int arg3) {
fn(arg1, arg2, arg3);
}
//.
// CHECK: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C11, file: [[META1:![0-9]+]], isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)
// CHECK: [[META1]] = !DIFile(filename: "{{.*}}<stdin>", directory: {{.*}})
// CHECK: [[DBG11]] = distinct !DISubprogram(name: "foo", scope: [[META12:![0-9]+]], file: [[META12]], line: 24, type: [[META13:![0-9]+]], scopeLine: 24, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META0]], retainedNodes: [[META19:![0-9]+]])
// CHECK: [[META12]] = !DIFile(filename: "cfi-icall-normalize2-debuginfo.c", directory: "")
// CHECK: [[META13]] = !DISubroutineType(types: [[META14:![0-9]+]])
// CHECK: [[META14]] = !{null, [[META15:![0-9]+]], [[META18:![0-9]+]]}
// CHECK: [[META15]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META16:![0-9]+]], size: 64)
// CHECK: [[META16]] = !DISubroutineType(types: [[META17:![0-9]+]])
// CHECK: [[META17]] = !{null, [[META18]]}
// CHECK: [[META18]] = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
// CHECK: [[META19]] = !{[[META20]], [[META21]]}
// CHECK: [[META20]] = !DILocalVariable(name: "fn", arg: 1, scope: [[DBG11]], file: [[META12]], line: 24, type: [[META15]])
// CHECK: [[META21]] = !DILocalVariable(name: "arg", arg: 2, scope: [[DBG11]], file: [[META12]], line: 24, type: [[META18]])
// CHECK: [[META22]] = !{i64 0, !"_ZTSFvPFvu3i32ES_E.normalized"}
// CHECK: [[META23]] = !{i64 0, !"_ZTSFvPvu3i32E.normalized.generalized"}
// CHECK: [[META24]] = !DILocation(line: 0, scope: [[DBG11]])
// CHECK: [[DBG25]] = !DILocation(line: 0, scope: [[META26:![0-9]+]], inlinedAt: [[DBG29]])
// CHECK: [[META26]] = distinct !DISubprogram(name: "__ubsan_check_cfi_icall", scope: [[META27:![0-9]+]], file: [[META27]], type: [[META28:![0-9]+]], flags: DIFlagArtificial, spFlags: DISPFlagDefinition, unit: [[META0]])
// CHECK: [[META27]] = !DIFile(filename: "{{.*}}ubsan_interface.h", directory: {{.*}})
// CHECK: [[META28]] = !DISubroutineType(types: null)
// CHECK: [[DBG29]] = !DILocation(line: 25, column: 5, scope: [[DBG11]])
// CHECK: [[META30]] = !{}
// CHECK: [[PROF31]] = !{!"branch_weights", i32 1048575, i32 1}
// CHECK: [[DBG32]] = !DILocation(line: 0, scope: [[META33:![0-9]+]], inlinedAt: [[DBG25]])
// CHECK: [[META33]] = distinct !DISubprogram(name: "__clang_trap_msg$Undefined Behavior Sanitizer$Control flow integrity check failed", scope: [[META27]], file: [[META27]], type: [[META28]], flags: DIFlagArtificial, spFlags: DISPFlagDefinition, unit: [[META0]])
// CHECK: [[DBG34]] = !DILocation(line: 26, column: 1, scope: [[DBG11]])
// CHECK: [[DBG35]] = distinct !DISubprogram(name: "bar", scope: [[META12]], file: [[META12]], line: 43, type: [[META36:![0-9]+]], scopeLine: 43, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META0]], retainedNodes: [[META41:![0-9]+]])
// CHECK: [[META36]] = !DISubroutineType(types: [[META37:![0-9]+]])
// CHECK: [[META37]] = !{null, [[META38:![0-9]+]], [[META18]], [[META18]]}
// CHECK: [[META38]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META39:![0-9]+]], size: 64)
// CHECK: [[META39]] = !DISubroutineType(types: [[META40:![0-9]+]])
// CHECK: [[META40]] = !{null, [[META18]], [[META18]]}
// CHECK: [[META41]] = !{[[META42]], [[META43]], [[META44]]}
// CHECK: [[META42]] = !DILocalVariable(name: "fn", arg: 1, scope: [[DBG35]], file: [[META12]], line: 43, type: [[META38]])
// CHECK: [[META43]] = !DILocalVariable(name: "arg1", arg: 2, scope: [[DBG35]], file: [[META12]], line: 43, type: [[META18]])
// CHECK: [[META44]] = !DILocalVariable(name: "arg2", arg: 3, scope: [[DBG35]], file: [[META12]], line: 43, type: [[META18]])
// CHECK: [[META45]] = !{i64 0, !"_ZTSFvPFvu3i32S_ES_S_E.normalized"}
// CHECK: [[META46]] = !{i64 0, !"_ZTSFvPvu3i32S0_E.normalized.generalized"}
// CHECK: [[META47]] = !DILocation(line: 0, scope: [[DBG35]])
// CHECK: [[DBG48]] = !DILocation(line: 0, scope: [[META26]], inlinedAt: [[DBG49]])
// CHECK: [[DBG49]] = !DILocation(line: 44, column: 5, scope: [[DBG35]])
// CHECK: [[DBG50]] = !DILocation(line: 0, scope: [[META33]], inlinedAt: [[DBG48]])
// CHECK: [[DBG51]] = !DILocation(line: 45, column: 1, scope: [[DBG35]])
// CHECK: [[DBG52]] = distinct !DISubprogram(name: "baz", scope: [[META12]], file: [[META12]], line: 63, type: [[META53:![0-9]+]], scopeLine: 63, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META0]], retainedNodes: [[META58:![0-9]+]])
// CHECK: [[META53]] = !DISubroutineType(types: [[META54:![0-9]+]])
// CHECK: [[META54]] = !{null, [[META55:![0-9]+]], [[META18]], [[META18]], [[META18]]}
// CHECK: [[META55]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META56:![0-9]+]], size: 64)
// CHECK: [[META56]] = !DISubroutineType(types: [[META57:![0-9]+]])
// CHECK: [[META57]] = !{null, [[META18]], [[META18]], [[META18]]}
// CHECK: [[META58]] = !{[[META59]], [[META60]], [[META61]], [[META62]]}
// CHECK: [[META59]] = !DILocalVariable(name: "fn", arg: 1, scope: [[DBG52]], file: [[META12]], line: 63, type: [[META55]])
// CHECK: [[META60]] = !DILocalVariable(name: "arg1", arg: 2, scope: [[DBG52]], file: [[META12]], line: 63, type: [[META18]])
// CHECK: [[META61]] = !DILocalVariable(name: "arg2", arg: 3, scope: [[DBG52]], file: [[META12]], line: 63, type: [[META18]])
// CHECK: [[META62]] = !DILocalVariable(name: "arg3", arg: 4, scope: [[DBG52]], file: [[META12]], line: 63, type: [[META18]])
// CHECK: [[META63]] = !{i64 0, !"_ZTSFvPFvu3i32S_S_ES_S_S_E.normalized"}
// CHECK: [[META64]] = !{i64 0, !"_ZTSFvPvu3i32S0_S0_E.normalized.generalized"}
// CHECK: [[META65]] = !DILocation(line: 0, scope: [[DBG52]])
// CHECK: [[DBG66]] = !DILocation(line: 0, scope: [[META26]], inlinedAt: [[DBG67]])
// CHECK: [[DBG67]] = !DILocation(line: 64, column: 5, scope: [[DBG52]])
// CHECK: [[DBG68]] = !DILocation(line: 0, scope: [[META33]], inlinedAt: [[DBG66]])
// CHECK: [[DBG69]] = !DILocation(line: 65, column: 1, scope: [[DBG52]])
//.