microsoft / microsoft/DirectXShaderCompiler

[Assert Triggered] MaybeODRUseExprs.empty() && "Leftover expressions for odr-use checking"

Open
#6,005 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C++
Stars
3.7k
Forks
900
Avg merge
2d 11h
Merged PRs (30d)
44

Description

Description
I'm hitting an assert with a message "MaybeODRUseExprs.empty() && "Leftover expressions for odr-use checking""

This started happening after I added typedefs for vector and matrix with identical identifiers as HLSL's builtins in my own namespace.

Steps to Reproduce
I've setup a http://godbolt.devsh.eu which builds latest DXC from trunk, because the official Godbolt is like 5 months behind.

Unfortunately I have no clue if this only happens in SPIR-V out or DXIL too because I don't have a debug build of DXC.exe around.
(I'd kill for a -print-asserts option that would print the messages even in Release builds)

Sorry about the long link, we haven't made the short ones work yet (and persist across container updates).
link

Actual Behavior
The shader still compiles, I just hit this nasty assert.

Environment

  • DXC version dxcompiler.dll: 1.7 - 1.7.0.4202 (050946367)
  • Host Operating System Windows

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the assertion with the linked Godbolt example and a debug DXC build, then trace the "Leftover expressions for odr-use checking" assertion through the compiler's ODR-use checking code. Compare behavior with and without the user-defined vector and matrix typedefs, and add a regression test demonstrating that the shader compiles without triggering the assertion.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.