[LLVMbugs] [Bug 9056] New: -Wuninitialized false positive with foreach objc construct.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jan 26 00:50:25 PST 2011


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

           Summary: -Wuninitialized false positive with foreach objc
                    construct.
           Product: clang
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: devlists at shadowlab.org
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=6051)
 --> (http://llvm.org/bugs/attachment.cgi?id=6051)
Test case

The recent merge of -Wuninitialized-experimental with -Wuninitialized
introduces a very annoying false positive.

When using the "for in" objc syntax, clang emits a warning.

------------ foreach.m
void test() {
  id collection = 0;
  for (id obj in collection) {
    if (0 == obj)
      break;
  }
}
------------
clang -fsyntax-only -Wuninitialized foreach.m
foreach.m:4:8: warning: use of uninitialized variable 'obj' [-Wuninitialized]
  for (id obj in collection) {
       ^~~~~~
foreach.m:5:11: note: variable 'obj' is possibly uninitialized when used here
        if (0 == obj)
                 ^~~
foreach.m:4:14: note: add initialization to silence this warning
  for (id obj in collection) {
             ^
              = 0
1 warning generated.

-- 
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