Skip to content

Spurious uninitialized variable warning #9451

@llvmbot

Description

@llvmbot
Bugzilla Link 9079
Resolution WONTFIX
Resolved on Jan 31, 2011 13:51
Version trunk
OS MacOS X
Attachments example
Reporter LLVM Bugzilla Contributor
CC @tkremenek

Extended Description

If a local is initialized within some 'if' guarded by a condition and later is accessed only if that same condition is true, clang emits a warning.

The case I just hit in my code has structure similar to this:

int x(int y)
{
int value;
if (y != 0) {
value = 0;
}

switch (y) {
case 0:
return 1; // handles the uninitialized case
default:
return value; // can only get here if the value=0 line was executed
}
}

This is probably a duplicate, but this test case may be different enough.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillaclang:frontendLanguage frontend issues, e.g. anything involving "Sema"wontfixIssue is real, but we can't or won't fix it. Not invalid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions