Skip to content

slangc fails to warn about uninitialized variables being assigned to inout parameters #11763

Description

@yonatan

Issue Description

slangc fails to warn about uninitialized variables when they are assigned to inout parameters.

Reproducer Code

// compile with:
// slangc shader.slang -target cpp -entry main -stage compute -o /dev/null

[shader("compute")]
[numthreads(1, 1, 1)]

void test(inout float x) {
    float uninit;
    x = uninit; // <--- use of uninitialized variable
}

void main() {
    float x;
    test(x);
    printf("%f\n", x);
}

Expected Behavior

warning[E41016]: use of uninitialized variable 'uninit'

Actual Behavior

No warning.

Environment

  • Slang Version: 2026.9.1 and 2026.10-13-gd25453d7f
  • OS: Linux

Additional context

With an out instead of inout slangc says "warning[E41018]: returning without initializing out parameter" (which is also slightly wrong imo, I'd complain about the use of 'uninit' instead).

Metadata

Metadata

Assignees

Labels

DiagnosticsMissing DiagnosticWe should be emitting a diagnostics but we don't or crash or emit bad codereproducedProvided instructions confirmed to reproduce the issue

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions