https://llvm.org/bugs/show_bug.cgi?id=23146

            Bug ID: 23146
           Summary: Missing 'null passed to a callee that requires a
                    non-null argument' warning for block expression
                    invocations
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

Bug 23117 fixed (in r234297) an assertion failure that occurred when nonnull
attributes appertain to block declarations.  Warnings are issued when invoking
a block with a null argument for a block with a corresponding nonnull parameter
when the attribute is explicitly specified for a block pointer type, but not
for block invocations on block expressions that specify the attribute.  In the
following example, a warning is emitted for the invocation of bp(0), but not
for the block expression invocation.

$ cat t.c
void(^bp)(int *) __attribute__((nonnull(1)));
void f() {
    bp(0); // expected-warning{{null passed to a callee that requires a
non-null argument}}
    ^(int *p1) __attribute__((nonnull(1))) {}(0); // expected-warning{{null
passed to a callee that requires a non-null argument}}
}

$ clang -fblocks -c t.c
t.c:3:9: warning: null passed to a callee that requires a non-null argument
[-Wnonnull]
    bp(0);
       ~^
1 warning generated.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to