[llvm-bugs] [Bug 35059] New: -fsanitize=null instrumentation causes assertion failure with release-mode arc

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Oct 24 08:28:13 PDT 2017


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

            Bug ID: 35059
           Summary: -fsanitize=null instrumentation causes assertion
                    failure with release-mode arc
           Product: libraries
           Version: trunk
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Transformation Utilities
          Assignee: unassignedbugs at nondot.org
          Reporter: francisjricci at gmail.com
                CC: llvm-bugs at lists.llvm.org

$ cat /tmp/reduced.m
typedef struct { void *a; } bar;

void foo(bar *ptr) {
    void *block;
    void (^b)(void *result) = (__bridge void (^)(void *result))block;
    void *val = ptr->a;
}

$ clang -cc1 -triple x86_64-apple-darwin -emit-obj -O1 -fsanitize=null -fblocks
-fobjc-arc -o /tmp/reduced.o -x objective-c /tmp/reduced.m

clang: llvm/lib/Transforms/ObjCARC/ObjCARC.h:62: void
llvm::objcarc::EraseInstruction(llvm::Instruction*): Assertion
`(IsForwarding(GetBasicARCInstKind(CI)) ||
(IsNoopOnNull(GetBasicARCInstKind(CI)) && isa<ConstantPointerNull>(OldArg))) &&
"Can't delete non-forwarding instruction with users!"' failed.

Note that if `void *block` is initialized to 0, the assertion failure goes
away.

The assertion does not repro with -O0, or with casts to more generic types (ie
a cast to a forward-declared @class instead of a cast to a block).

-- 
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/20171024/99ff9f53/attachment.html>


More information about the llvm-bugs mailing list