<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 - "Wrong types for attribute" linking cbindgen with LTO"
   href="https://bugs.llvm.org/show_bug.cgi?id=49963">49963</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>"Wrong types for attribute" linking cbindgen with LTO
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>alex_y_xu@yahoo.ca
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I'm pretty sure this worked in LLVM 11, and doesn't work in LLVM 12.0.0-rc4.

Steps to reproduce:

1. get cbindgen-0.19.0
2. RUSTFLAGS='-C linker=clang -C linker-plugin-lto -C link-arg=-fuse-ld=lld'
cargo build --release

Expected results:

It builds.

Actual results:

Wrong types for attribute: inalloca nest noalias nocapture noundef nonnull
readnone readonly signext zeroext byref(void) byval(void) preallocated(void)
sret(void) align 1 dereferenceable(1) dereferenceable_or_null(1)
  tail call fastcc align 8 void
@"_ZN5alloc5boxed16Box$LT$T$C$A$GT$13new_uninit_in28_$u7b$$u7b$closure$u7d$$u7d$17hbccd242c986790e3E.llvm.8415993583334446782"(i64
%15, i64 %14) #27, !noalias !2535
in function
_ZN5alloc5boxed16Box$LT$T$C$A$GT$13new_uninit_in17h5b16d4d82e1b1c53E
LLVM ERROR: Broken function found, compilation aborted!
PLEASE submit a bug report to <a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash
backtrace.
Stack dump:
0.      Running pass 'Function Pass Manager' on module
'/tmp/portage/dev-util/cbindgen-0.19.0/work/cbindgen-0.19.0/target/release/deps/cbindgen-799b8ea374c5985e.cbindgen.dndfdl99-cgu.13.rcgu.o'.
1.      Running pass 'Module Verifier' on function
'@"_ZN5alloc5boxed16Box$LT$T$C$A$GT$13new_uninit_in17h5b16d4d82e1b1c53E"'
Wrong types for attribute: inalloca nest noalias nocapture noundef nonnull
readnone readonly signext zeroext byref(void) byval(void) preallocated(void)
sret(void) align 1 dereferenceable(1) dereferenceable_or_null(1)
  tail call fastcc align 8 void
@"_ZN5alloc5boxed16Box$LT$T$C$A$GT$13new_uninit_in28_$u7b$$u7b$closure$u7d$$u7d$17hbccd242c986790e3E.llvm.8415993583334446782"(i64
%15, i64 %14) #21, !noalias !2033
in function
_ZN5alloc5boxed16Box$LT$T$C$A$GT$13new_uninit_in17h5b16d4d82e1b1c53E
LLVM ERROR: Broken function found, compilation aborted!</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>