[LLVMbugs] [Bug 7815] New: 'x' is always zero in this context should not apply to LHS of assignment

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Aug 4 13:43:13 PDT 2010


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

           Summary: 'x' is always zero in this context should not apply to
                    LHS of assignment
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: nlewycky at google.com
                CC: llvmbugs at cs.uiuc.edu, jyasskin at google.com


This program emits an unexpected warning:

  int f();

  void test() {
    if (int x = f()) {
      x = 1;  // ok
    } else {
      x = 2;  // warning: 'x' is always zero in this context
    }
  }

There's no reason to warn about the left-hand side of the expression being
zero, its value isn't really relevant.

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