[LLVMbugs] [Bug 17208] New: False-positive warnings about BOOL conversions in Obj-C with -Wconversion

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Sep 12 07:24:48 PDT 2013


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

            Bug ID: 17208
           Summary: False-positive warnings about BOOL conversions in
                    Obj-C with -Wconversion
           Product: clang
           Version: trunk
          Hardware: PC
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: fourdman at google.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

CLANG_REVISION=188423

Steps: compile the test file (see below)
Expected: no warnings
Actual: 3 false-positive warnings


%
/Volumes/CSTree/foor/chromium/trunk/src/third_party/llvm-build/Release+Asserts/bin/clang
-x objective-c -arch i386 -std=gnu99 -fobjc-arc -Wconversion -iframework
Foundation -fobjc-abi-version=2 -O0 -c test.mm -o test.o
test.mm:17:14: warning: implicit conversion loses integer precision: 'int' to
'BOOL' (aka 'signed char') [-Wconversion]
    self.a = !b;  // Error 1
           ~ ^~
test.mm:21:14: warning: implicit conversion loses integer precision: 'int' to
'BOOL' (aka 'signed char') [-Wconversion]
    self.a = (x == y);  // Error 2
           ~ ^~~~~~~~
test.mm:23:14: warning: implicit conversion loses integer precision: 'int' to
'BOOL' (aka 'signed char') [-Wconversion]
    self.a = (a_ || b);  // Error 3
           ~ ^~~~~~~~~
3 warnings generated.

% cat test.mm
#import <Foundation/Foundation.h>

@interface Foo : NSObject

@property(assign, nonatomic) BOOL a;

- (void)qux;

@end

@implementation Foo

@synthesize a = a_;

- (void)qux {
    BOOL b = NO;
    self.a = !b;  // Error 1

    int x = 5;
    int y = 4;
    self.a = (x == y);  // Error 2

    self.a = (a_ || b);  // Error 3
}

@end

-- 
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/20130912/92fb6017/attachment.html>


More information about the llvm-bugs mailing list