[LLVMbugs] [Bug 23117] New: Assertion failure parsing block expressions with nonnull attributes

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Apr 3 10:47:31 PDT 2015


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

            Bug ID: 23117
           Summary: Assertion failure parsing block expressions with
                    nonnull attributes
           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

An assertion failure occurs in Clang 3.5 through trunk (r234011) when a nonnull
attribute appears on a Block expression.  Clang 3.4 issues a warning for these
cases.  The check for a non-function declaration that previously resulted in
the warning was removed in r199387.

$ cat t.c
void(^bp1)(int *) = ^(int *p1) __attribute__((nonnull(1))) {};

$ clang-trunk --version
clang version 3.7.0 (trunk 234011)
Target: x86_64-unknown-linux-gnu
Thread model: posix

$ clang-trunk -c -fblocks t.c
clang:
/nfs/thonermann/src/llvm-trunk/tools/clang/lib/Sema/SemaDeclAttr.cpp:260: bool
checkFunctionOrMethodParameterIndex(clang::Sema &, const clang::Decl *, const
clang::AttributeList &, unsigned int, const clang::Expr *, uint64_t &):
Assertion `isFunctionOrMethod(D)' failed.
...

$ clang-3.4 --version
clang version 3.4 (tags/RELEASE_34/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix

$ clang-3.4 -c -fblocks t.c
t.c:1:47: warning: 'nonnull' attribute only applies to functions
[-Wignored-attributes]
void(^bp1)(int *) = ^(int *p1) __attribute__((nonnull(1))) {};
                                              ^
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/20150403/adb782e3/attachment.html>


More information about the llvm-bugs mailing list