[LLVMbugs] [Bug 8806] New: Incorrect warning: expression result unused

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Dec 18 00:06:37 PST 2010


           Summary: Incorrect warning: expression result unused
           Product: clang
           Version: unspecified
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: github at geheimwerk.de
                CC: llvmbugs at cs.uiuc.edu

I get this warning when building the code below with Clang 1.6:

warning: expression result unused [-Wunused-value]
         for (NSUInteger j = finish; j >= start, j != NSUIntegerMax; j--) {
                                     ~ ^  ~~~~~

I am absolutely sure that the expression is indeed used so even if I am doing
something funky the warning is incorrect.

----- SNIP -----
// ObjC Foundation command line utility 
#import <Foundation/Foundation.h>

int main (int argc, const char * argv[]) {
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

    NSString *text = @"01234567890123456789";

    NSUInteger start = 0;
    NSUInteger finish = 10;

    for (NSUInteger j = finish; j >= start, j != NSUIntegerMax; j--) {
        NSLog(@"%C\n", [text characterAtIndex:j]);

    [pool drain];
    return 0;

----- SNIP -----

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