[LLVMbugs] [Bug 18561] New: No warning for unused computed values in comma expressions

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jan 20 15:52:09 PST 2014


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

            Bug ID: 18561
           Summary: No warning for unused computed values in comma
                    expressions
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: chengniansun at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Clang does not warn unused expression computed in a comma expression. Please
refer to the following steps:


$: cat unused-computed-value.c
int f(void) {return 0;}

int g(int a) {
  return (f() && a), 1;
}
$: clang-trunk -Wunused-value -c unused-computed-value.c
$: clang-trunk --version
clang version 3.5 (trunk 199549)
Target: x86_64-unknown-linux-gnu
Thread model: posix
$: gcc-trunk -Wunused-value -c unused-computed-value.c
unused-computed-value.c: In function ā€˜gā€™:
unused-computed-value.c:4:15: warning: value computed is not used
[-Wunused-value]
   return (f() && a), 1;
               ^

-- 
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/20140120/1c734f80/attachment.html>


More information about the llvm-bugs mailing list