[LLVMbugs] [Bug 18980] New: Confusing location information of -Wunused-value warnings

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Feb 26 14:10:18 PST 2014


            Bug ID: 18980
           Summary: Confusing location information of -Wunused-value
           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

@trunk trunk 202299

The expression (i ? pf : pv) has no side effect, and therefore the computed
value is not used. Clang indicates that "pf" is not used. But to me it seems
not complete, as "pv" is also not used. 

$: cat s.c 
void a(int i) {
  int (*pf)[2];
  int (*pv)[i + 1];
  (i ? pf : pv);
$: clang-trunk -Wunused-value -c s.c
s.c:4:8: warning: expression result unused [-Wunused-value]
  (i ? pf : pv);
1 warning generated.

$: gcc-trunk -Wunused-value -c s.c
s.c: In function ‘a’:
s.c:4:3: warning: statement with no effect [-Wunused-value]
   (i ? pf : pv);

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/20140226/e6289c18/attachment.html>

More information about the llvm-bugs mailing list