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

Report error on local variables with resource binding #6971

Open
hekota opened this issue Oct 16, 2024 · 1 comment
Open

Report error on local variables with resource binding #6971

hekota opened this issue Oct 16, 2024 · 1 comment
Labels
bug Bug, regression, crash diagnostic Issues for diagnostics incorrect-code Issues relating to handling of incorrect code
Milestone

Comments

@hekota
Copy link
Member

hekota commented Oct 16, 2024

Description
DXC should report error on local variable with resource binding.

Steps to Reproduce

For cs_6_5 this reports an error local resource not guaranteed to map to unique global resource.
https://godbolt.org/z/qhP8dqbed

[numthreads(4,1,1)]
void main() {
  RWBuffer<int> buf : register(u0);
  buf[0] = 1;
}

For cs_6_6 it does not report an error, generatesannotateHandle without createHandle, and the resource binding is not captured in metadata.
https://godbolt.org/z/xcadsEjzr

For lib_6_6 it also does not report an error, produces annotateHandle and createHandleForLib, and the resource binding is not captured in metadata.
https://godbolt.org/z/MWzdTEb6q

export int foo() {
  RWBuffer<int> buf : register(u0);
  return buf.Load(0);
}

Actual Behavior
Local resources with bindings should not be allowed and the compiler should report an error.

Environment

  • DXC main as od 10/16/2024
  • Windows 11 / Compiler Explorer
@hekota hekota added bug Bug, regression, crash needs-triage Awaiting triage labels Oct 16, 2024
@damyanp damyanp added diagnostic Issues for diagnostics incorrect-code Issues relating to handling of incorrect code and removed needs-triage Awaiting triage labels Oct 17, 2024
@damyanp damyanp moved this to Triaged in HLSL Triage Oct 17, 2024
@damyanp
Copy link
Member

damyanp commented Oct 17, 2024

Somewhat related, since validation should pick this up: #4415

@damyanp damyanp added this to the Dormant milestone Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug, regression, crash diagnostic Issues for diagnostics incorrect-code Issues relating to handling of incorrect code
Projects
Status: Triaged
Development

No branches or pull requests

2 participants