[LLVMbugs] [Bug 9079] New: Spurious uninitialized variable warning

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jan 27 15:40:59 PST 2011


http://llvm.org/bugs/show_bug.cgi?id=9079

           Summary: Spurious uninitialized variable warning
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: tjw at omnigroup.com
                CC: llvmbugs at cs.uiuc.edu


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.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list