<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - -fsanitize=null instrumentation causes assertion failure with release-mode arc"
   href="https://bugs.llvm.org/show_bug.cgi?id=35059">35059</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>-fsanitize=null instrumentation causes assertion failure with release-mode arc
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Transformation Utilities
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>francisjricci@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>$ 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).</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>