[SPIRV][NFC] Add test that triggers ASAN failure#182550
Closed
jmmartinez wants to merge 1 commit intousers/jmmartinez/spirv/memory-issues-1from
Closed
[SPIRV][NFC] Add test that triggers ASAN failure#182550jmmartinez wants to merge 1 commit intousers/jmmartinez/spirv/memory-issues-1from
jmmartinez wants to merge 1 commit intousers/jmmartinez/spirv/memory-issues-1from
Conversation
ff83e88 to
f453e41
Compare
09725d0 to
889f96f
Compare
This was referenced Feb 20, 2026
Member
|
@llvm/pr-subscribers-backend-spir-v Author: Juan Manuel Martinez Caamaño (jmmartinez) ChangesStacked PRs:
[SPIRV][NFC] Add test that triggers ASAN failureThis test is reduced from a failure detected after attempting to merge Without ASAN the test passes. Full diff: https://github.com/llvm/llvm-project/pull/182550.diff 1 Files Affected:
diff --git a/llvm/test/CodeGen/SPIRV/pointers/fun-ptr-to-itself.ll b/llvm/test/CodeGen/SPIRV/pointers/fun-ptr-to-itself.ll
new file mode 100644
index 0000000000000..3415f2839d163
--- /dev/null
+++ b/llvm/test/CodeGen/SPIRV/pointers/fun-ptr-to-itself.ll
@@ -0,0 +1,33 @@
+; XFAIL: asan
+; RUN: llc -mtriple=spirv32-unknown-unknown < %s --spirv-ext=+SPV_INTEL_function_pointers | FileCheck %s
+; RUN: %if spirv-tools %{ llc -mtriple=spirv32-unknown-unknown < %s -filetype=obj | not spirv-val 2>&1 | FileCheck --check-prefix=SPIRV-VAL %s %}
+
+; spirv-val poorly supports the SPV_INTEL_function_pointers extension.
+; In this case the function type used in a pointer type fails.
+; SPIRV-VAL: Invalid use of function type result id '[[#ID:]][%{{.*}}]'.
+; SPIRV-VAL: %_ptr_Generic_4 = OpTypePointer Generic %[[#ID]]
+
+; CHECK-DAG: OpCapability FunctionPointersINTEL
+; CHECK-DAG: OpExtension "SPV_INTEL_function_pointers"
+; CHECK-DAG: %[[#Void:]] = OpTypeVoid
+; CHECK-DAG: %[[#FnTy:]] = OpTypeFunction %[[#Void]]
+; CHECK-DAG: %[[#GenPtrTy:]] = OpTypePointer Generic %[[#FnTy]]
+; CHECK-DAG: %[[#GenPtrPtrTy:]] = OpTypePointer Function %[[#GenPtrTy]]
+; CHECK-DAG: %[[#Int8:]] = OpTypeInt 8 0
+; CHECK-DAG: %[[#Int8PtrTy:]] = OpTypePointer Function %[[#Int8]]
+; CHECK-DAG: %[[#CodePtrTy:]] = OpTypePointer CodeSectionINTEL %[[#FnTy]]
+; CHECK-DAG: %[[#Null:]] = OpConstantNull %[[#Int8PtrTy]]
+; CHECK-DAG: %[[#FnPtr:]] = OpConstantFunctionPointerINTEL %[[#CodePtrTy]] %[[#FnDef:]]
+; CHECK: %[[#FnDef]] = OpFunction %[[#Void]] None %[[#FnTy]]
+; CHECK: %[[#Cast:]] = OpPtrCastToGeneric %[[#GenPtrTy]] %[[#FnPtr]]
+; CHECK: %[[#BC:]] = OpBitcast %[[#GenPtrPtrTy]] %[[#Null]]
+; CHECK: OpStore %[[#BC]] %[[#Cast]] Aligned 8
+; CHECK: OpReturn
+; CHECK: OpFunctionEnd
+
+define void @foo() {
+entry:
+ store ptr addrspace(4) addrspacecast (ptr @foo to ptr addrspace(4)), ptr null, align 8
+ ret void
+}
+
|
s-perron
approved these changes
Feb 23, 2026
sarnex
approved these changes
Feb 23, 2026
|
|
||
| ; spirv-val poorly supports the SPV_INTEL_function_pointers extension. | ||
| ; In this case the function type used in a pointer type fails. | ||
| ; SPIRV-VAL: Invalid use of function type result id '[[#ID:]][%{{.*}}]'. |
Member
There was a problem hiding this comment.
Similar to my response on the other PR I don't think we should do this spirv-val output checking, but otherwise LGTM.
mgcarrasco
approved these changes
Feb 24, 2026
maarquitos14
approved these changes
Feb 24, 2026
Contributor
maarquitos14
left a comment
There was a problem hiding this comment.
Agree with @sarnex, but otherwise LGTM.
MrSidims
approved these changes
Feb 24, 2026
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This test is reduced from a failure detected after attempting to merge #178143.
Without ASAN the test passes.
spirv-valfails likely due to anunimplemented feature in
spirv-val(assuming our implementation is correct).Stacked PRs:
OpPointerTypeeven if unused #182551SPV_INTEL_function_pointerstests to checkspirv-valoutput #182549