Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion MaybeODRUseExprs.empty() && "Leftover expressions for odr-use checking" in heavily templated code #7001

Open
devshgraphicsprogramming opened this issue Nov 6, 2024 · 6 comments
Labels
bug Bug, regression, crash crash DXC crashing or hitting an assert
Milestone

Comments

@devshgraphicsprogramming
Copy link

devshgraphicsprogramming commented Nov 6, 2024

Description

We do some very simple metaprogramming consteval math for attributes

Steps to Reproduce

These sorts of bugs are a problem to reproduce on your official Godbolt as you don't have assertions/exception enabled builds:
https://godbolt.org/z/EnnPxqbfa

We have our own instance with a Debug build, but outside of a debugger you can't see the assertion being raised
our short links don't work yet

Actual Behavior

One assertion per compilation:

Error: assert(MaybeODRUseExprs.empty() && "Leftover expressions for odr-use checking")
File:
D:\work\Nabla\3rdparty\dxc\dxc\tools\clang\lib\Sema\SemaDecl.cpp(11119)
Func:    clang::Sema::ActOnFinishFunctionBody

Environment

  • DXC version: latest trunk as of Nov 04
  • Host Operating System: godbolt
@devshgraphicsprogramming devshgraphicsprogramming added bug Bug, regression, crash needs-triage Awaiting triage labels Nov 6, 2024
@devshgraphicsprogramming
Copy link
Author

devshgraphicsprogramming commented Nov 6, 2024

If you remove the SPIR-V specific [[]] attributes it might still assert without -spirv option

https://godbolt.org/z/Kqqx9nvbq

@llvm-beanz llvm-beanz added crash DXC crashing or hitting an assert and removed needs-triage Awaiting triage labels Nov 6, 2024
@llvm-beanz llvm-beanz added this to the Dormant milestone Nov 6, 2024
@llvm-beanz llvm-beanz moved this to Triaged in HLSL Triage Nov 6, 2024
@llvm-beanz
Copy link
Collaborator

There is nothing here which indicates that this actually is causing incorrect code generation, so the severity here seems extremely low. There are lots of asserts that fire in DXC for a variety of reasons, not all of them indicate actual failures, some of them are just incorrect asserts.

@devshgraphicsprogramming
Copy link
Author

There is nothing here which indicates that this actually is causing incorrect code generation, so the severity here seems extremely low. There are lots of asserts that fire in DXC for a variety of reasons, not all of them indicate actual failures, some of them are just incorrect asserts.

its somewhat annoying that my examples don't work/crash outside of a debugger.

How can I skip the asserts?

@devshgraphicsprogramming
Copy link
Author

I need a compile flag that can turn these asserts into prints to stdout or just skip them.

I started building more code on top of this and now I need to manually resume with the debugger 8 times for a single shader

@devshgraphicsprogramming
Copy link
Author

devshgraphicsprogramming commented Nov 13, 2024

Actually it seems that the assert is triggered by [[numthreads(static const member variable here,1,1)]]

https://tinyurl.com/2p2utrw5

there isn't even template or typedef/using involved

@Fletterio
Copy link

I'm having a similar issue with a similar pattern using COnstevalParameters, hitting an "unreachable" assert on SemaHLSL.cpp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug, regression, crash crash DXC crashing or hitting an assert
Projects
Status: Triaged
Development

No branches or pull requests

3 participants