[LLVMbugs] [Bug 18709] New: -Wconditional-uninitialized false positive

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Feb 3 09:31:29 PST 2014


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

            Bug ID: 18709
           Summary: -Wconditional-uninitialized false positive
           Product: clang
           Version: 3.4
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: htam at apple.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

-Wconditional-uninitialized leads to a number of false positives when variables
are conditionally saved and restored, even though the condition doesn't change
throughout the function.

$ cat foo.c
void foo(int bar) {
   int baz = 0;
   int baz_save;

   if (bar) baz_save = baz;
   if (bar) baz = baz_save;
}

$ clang foo.c -Wconditional-uninitialized -o /dev/null -c
foo.c:6:20: warning: variable 'baz_save' may be uninitialized when used here
     [-Wconditional-uninitialized]
   if (bar) baz = baz_save;
                  ^~~~~~~~
foo.c:3:17: note: initialize the variable 'baz_save' to silence this warning
   int baz_save;
               ^
                = 0
1 warning generated.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140203/f9dd9575/attachment.html>


More information about the llvm-bugs mailing list