Rust: Rustc hangs during llvm codegen when referencing a [large] array with std::ptr::read_volatile

Created on 27 Aug 2018  ·  3Comments  ·  Source: rust-lang/rust

This issue has been repro'd on stable and nightly on Windows, OSX, and Linux:

cargo 1.28.0 (96a2c7d16 2018-07-13)
release: 1.28.0
commit-hash: 96a2c7d16249cb47c61c887fc95ca8be60e7ef0a
commit-date: 2018-07-13

cargo 1.29.0-nightly (6a7672ef5 2018-08-14)
release: 1.29.0
commit-hash: 6a7672ef5344c1bb570610f2574250fbee932355
commit-date: 2018-08-14

Code:

fn main() {
    let x = [0u8; 128 * 128 * 4];
    let _y = unsafe { std::ptr::read_volatile(&x) };
}

Thanks to @talchas for the minimal repro. I believe they were able to repro it without _volatile as well.

A-LLVM

Most helpful comment

To be precise, I didn't repro it in rust without _volatile; my system llc (and thus presumably from a different version) hung when attempting to compile the --emit llvm-ir output, but segfaulted when attempting to compile either

define internal void @_ZN3foo4main17hb80e1f71fc6968e1E() unnamed_addr #0 {
start:
  %_y = alloca [65536 x i8], align 1
  %0 = load volatile [65536 x i8], [65536 x i8]* %_y, align 1
  ret void
}

or

define internal void @_ZN3foo4main17hb80e1f71fc6968e1E() unnamed_addr #0 {
start:
  %_y = alloca [65536 x i8], align 1
  %0 = load [65536 x i8], [65536 x i8]* %_y, align 1
  ret void
}

which might be a related issue or not.

All 3 comments

To be precise, I didn't repro it in rust without _volatile; my system llc (and thus presumably from a different version) hung when attempting to compile the --emit llvm-ir output, but segfaulted when attempting to compile either

define internal void @_ZN3foo4main17hb80e1f71fc6968e1E() unnamed_addr #0 {
start:
  %_y = alloca [65536 x i8], align 1
  %0 = load volatile [65536 x i8], [65536 x i8]* %_y, align 1
  ret void
}

or

define internal void @_ZN3foo4main17hb80e1f71fc6968e1E() unnamed_addr #0 {
start:
  %_y = alloca [65536 x i8], align 1
  %0 = load [65536 x i8], [65536 x i8]* %_y, align 1
  ret void
}

which might be a related issue or not.

https://bugs.llvm.org/show_bug.cgi?id=37000 is the LLVM bug you see here.

Triage: appears this is still a bug

Was this page helpful?
0 / 5 - 0 ratings