microsoft / microsoft/DirectXShaderCompiler

SIGSEGV when storing struct with buffer that was picked specifically from array of buffers

Open
#7,386 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Preamble

I acknowledge that storing a buffer binding into a buffer is ridiculous and not in spec. However, it should probably give an error, not sigsegv.

Description

Encountered a SIGSEGV running dxc on a shader when trying to find if there's any existing bugs in having structs contain buffers when compiled to spir-v. (this issue is a different error than the one I was looking for, this one happens when outputting dxil)

Steps to Reproduce

https://godbolt.org/z/8jhTebWY5

When the buffer buff3 is put into the struct and then stored, the compiler outputs a seemingly correct error.

However when a selection from the buff2 buffer array is put into the struct, and then stored, it crashes.

Behavior is identical for buff2[] and buff3 when outputting spirv. It only crashes for dxil.

Actual Behavior

SIGSEGV code 139

Environment

  • DXC version: 1.8.2403.2, 1.8.2502, and trunk
  • Host Operating System: godbolt + windows 11 22H2 - 22621.5189

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 with the Godbolt reproduction linked in the issue and run it through dxc using both DXIL and SPIR-V output. Compare the handling of a direct buffer versus a selected element from a buffer array, then trace the DXIL path until the differing behavior is identified. Done means the reproducer reports an error instead of terminating with SIGSEGV.

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.