microsoft / microsoft/DirectXShaderCompiler

Compiling empty source file fails with cryptic error message

Open
#6,136 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description

When compiling an empty source file, DXC fails with a cryptic error message, as opposed to an insightful error message. I thought I did something wrong with the compiler flags, but it turned out the source file was empty.

Steps to Reproduce

$ echo -n > empty.hlsl
$ dxc -T vs_6_0 empty.hlsl

Actual Behavior

DXC prints:

dxc failed : Invalid argument.

Environment

  • DXC version: libdxcompiler.so: 1.7(dev;4006-69e54e29); libdxil.so: 1.7
  • Host Operating System: NixOS GNU/Linux 23.11.928.50aa30a13c4a (Tapir)

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

Reproduce the failure with the dxc -T vs_6_0 empty.hlsl command and an empty empty.hlsl file. Trace the compiler's handling of an empty source to identify where the generic Invalid argument diagnostic is produced; done means the command reports an informative empty-source error.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
cli, 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.