Fix stale ODR-use state before lexed inline methods#8324
Open
AnastaZIuk wants to merge 1 commit intomicrosoft:mainfrom
Open
Fix stale ODR-use state before lexed inline methods#8324AnastaZIuk wants to merge 1 commit intomicrosoft:mainfrom
AnastaZIuk wants to merge 1 commit intomicrosoft:mainfrom
Conversation
This was referenced Apr 1, 2026
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.
Summary
This clears stale delayed ODR-use bookkeeping before starting a lexed inline method body.
It also adds a small SPIR-V regression test for the same parser path.
Root cause
The missing cleanup is in
ParseLexedMethodDef, which was introduced in 6ee4074a4.That path enters
ActOnStartOfFunctionDef(...)without first callingCleanupVarDeclMarking().HLSL constant-expression references inside declarations such as
[[vk::binding(Bindings::Mask, SessionDSIndex)]]can leave entries inMaybeODRUseExprs.When the next lexed inline method is parsed,
ActOnFinishFunctionBody(...)trips the debug invariant:Leftover expressions for odr-use checkingImpact
This crashes assert-enabled DXC builds on valid HLSL.
Public release-like builds usually compile the same source because assertions are off, so the bug is masked rather than absent.
Repros
NSC -P: godbolt.org/z/81nsEja1vtools/clang/test/CodeGenSPIRV/ex40-lexed-inline-method-odr-use-crash.hlsl: godbolt.org/z/3zfraP9bfBoth CE links use the public
dxc_trunkbuild, so they compile there because that build does not expose the local debug assert path.