Skip to content

DXC generates spurious warning for unintialized vars #2494

Closed as not planned
Closed as not planned

Description

DXC generates below uninitialized warning when compiling below shader even when structure is initialized.

warning: variable 's' is uninitialized when used here
        Foo(s);
            ^
note: initialize the variable 's' to silence this warning
        ST s;
            ^
             = {}
%dxc -E main -T vs_6_0 %s
struct ST
{
	int a;
};
 
void Foo( out ST s )
{
	s.a = 0;
}
 
ST main() : OUT
{
	ST s;
	Foo(s);
	return s;
}

Activity

  1. vcsharma commented on Sep 27, 2019

    @vcsharma
    ContributorAuthor

    The uninitialized warnings were enabled in #2424 by enabling the clang diagnostic for uninitialized vars, but looks like it doesn't take into account input modifiers out/inout when a variable/struct is passed as an function argument.

  2. added
    bug
    on Dec 5, 2019
  3. llvm-beanz commented on Aug 8, 2023

    @llvm-beanz
    Collaborator

    This is caused by invalid LValueToRValue casts in HLSL call sites. It will be resolved by #5249.

  4. damyanp commented on Jun 18, 2024

    @damyanp
    Member

    We're not going to address this in DXC - the scale of the change required to do this properly is not worth it when we have clang coming up that will get this right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions