<p dir="auto">The following code is miscompiled on my OS X laptop:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="use std;

native &quot;cdecl&quot; mod libc = &quot;&quot; {
    fn printf(s: *u8, a: int); /* A tenuous definition, indeed.  Herp, derp. */
}

fn main() {
    let b = std::str::bytes(&quot;%d\n&quot;);
    let b8 = unsafe { std::vec::unsafe::to_ptr(b) };
    libc::printf(b8, 4);
    let a = bind libc::printf(b8, 5);
    a(); /* core dump */
}"><pre class="notranslate"><code class="notranslate">use std;

native "cdecl" mod libc = "" {
    fn printf(s: *u8, a: int); /* A tenuous definition, indeed.  Herp, derp. */
}

fn main() {
    let b = std::str::bytes("%d\n");
    let b8 = unsafe { std::vec::unsafe::to_ptr(b) };
    libc::printf(b8, 4);
    let a = bind libc::printf(b8, 5);
    a(); /* core dump */
}
</code></pre></div>
<p dir="auto">I also reproed on my Linux machine, in which I captured this GDB session:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="(gdb) break printf
Breakpoint 1 at 0x8048b78
(gdb) run
Starting program: /storage/homes/joshua/rust/build/bindbad
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[Thread debugging using libthread_db enabled]
[New Thread 0xf7917b70 (LWP 15444)]
[Switching to Thread 0xf7917b70 (LWP 15444)]

Breakpoint 1, __printf (format=0x804ca68 &quot;%d\n&quot;) at printf.c:29
29      printf.c: No such file or directory.
        in printf.c
(gdb) c
Continuing.
4

Breakpoint 1, __printf (format=0x10 &lt;Address 0x10 out of bounds&gt;) at printf.c:29
29      in printf.c
(gdb)"><pre class="notranslate"><code class="notranslate">(gdb) break printf
Breakpoint 1 at 0x8048b78
(gdb) run
Starting program: /storage/homes/joshua/rust/build/bindbad
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[Thread debugging using libthread_db enabled]
[New Thread 0xf7917b70 (LWP 15444)]
[Switching to Thread 0xf7917b70 (LWP 15444)]

Breakpoint 1, __printf (format=0x804ca68 "%d\n") at printf.c:29
29      printf.c: No such file or directory.
        in printf.c
(gdb) c
Continuing.
4

Breakpoint 1, __printf (format=0x10 &lt;Address 0x10 out of bounds&gt;) at printf.c:29
29      in printf.c
(gdb)
</code></pre></div>
<p dir="auto">this test (src/test/run-pass/c-stack-as-value.rs) yields a LLVM compilation error:</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// xfail-test

native &quot;c-stack-cdecl&quot; mod rustrt {
    fn unsupervise();
}

fn main() {
    let _foo = rustrt::unsupervise;
}"><pre class="notranslate"><span class="pl-c">// xfail-test</span>

native <span class="pl-s">"c-stack-cdecl"</span> <span class="pl-k">mod</span> rustrt <span class="pl-kos">{</span>
    <span class="pl-k">fn</span> <span class="pl-en">unsupervise</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-k">fn</span> <span class="pl-en">main</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-k">let</span> _foo = rustrt<span class="pl-kos">::</span>unsupervise<span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>