[LLVMbugs] [Bug 23146] New: Missing 'null passed to a callee that requires a non-null argument' warning for block expression invocations

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Apr 7 07:01:36 PDT 2015


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: unassignedclangbugs at nondot.org
          Reporter: thonermann at coverity.com
                CC: llvmbugs at cs.uiuc.edu
    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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150407/7c9fba10/attachment.html>


More information about the llvm-bugs mailing list