microsoft / microsoft/DirectXShaderCompiler

Passing string literal to templated function causes validation errors when optimizations are disabled

Open
#6,154 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description
Passing string literal to templated function causes validation errors when optimizations are disabled (using -Od) but works fine with optimizations enabled.

Steps to Reproduce
Minimal reproducible example: godbolt

I am not sure what is expected behavior, should the dxc reject or accept the code but it should behave the same despite different optimization flags.

Environment

  • DXC version 1.7.2207, 1.7.2308
  • Windows 21H2

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 minimal reproducible example linked on Godbolt and compare validation with optimizations enabled and with -Od using the reported DXC versions. Trace the compiler path responsible for validation and establish whether the templated string-literal case should be accepted or rejected; done means both optimization modes behave consistently.

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
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.