Skip to content

Instantly share code, notes, and snippets.

@Twinklebear
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Twinklebear/0b6efd45b420507901ac to your computer and use it in GitHub Desktop.
Save Twinklebear/0b6efd45b420507901ac to your computer and use it in GitHub Desktop.
Rust LTO related instruction bug with opening files
[root]
name = "bug_repr"
version = "0.0.1"
[package]
name = "bug_repr"
version = "0.0.1"
authors = ["Will Usher <willusher.life@gmail.com>"]
[[bin]]
name = "bug_repr"
path = "main.rs"
[profile.release]
opt-level = 0
debug = false
rpath = false
lto = true
Compiling bug_repr v0.0.1 (file:///home/sci/will/Repos/0b6efd45b420507901ac)
main.rs:4:9: 4:10 warning: unused variable: `f`, #[warn(unused_variables)] on by default
main.rs:4 let f = File::open(&Path::new("out.ppm"));
^
main.rs:4:25: 4:34 warning: use of unstable item, #[warn(unstable)] on by default
main.rs:4 let f = File::open(&Path::new("out.ppm"));
^~~~~~~~~
main.rs:4:13: 4:23 warning: use of unstable item, #[warn(unstable)] on by default
main.rs:4 let f = File::open(&Path::new("out.ppm"));
^~~~~~~~~~
Instruction does not dominate all uses!
%oldret4 = insertvalue %"enum.core::result::Result<[\22()\22, \22core::fmt::Error\22]>[#2]" %oldret2, [0 x i8] %newret3, 2
%.sink.i.i = phi %"enum.core::result::Result<[\22()\22, \22core::fmt::Error\22]>[#2]" [ %oldret10, %.noexc8.i ], [ %oldret4, %_ZN6string18String.fmt..String3fmt20h74aeaff0c04f8a35kCiE.exit ]
Instruction does not dominate all uses!
%94 = invoke fastcc { i8, [0 x i8], [0 x i8] } @"_ZN3fmt24Formatter$LT$$u{27}a$GT$3pad20h6fcd1b9b2d92a242qjwE"(%"struct.core::fmt::Formatter[#2]"* noalias dereferenceable(96) %1, %str_slice* noalias nocapture dereferenceable(16) %arg.i.i)
to label %_ZN6string18String.fmt..String3fmt20h74aeaff0c04f8a35kCiE.exit unwind label %unwind_ast_45109_.i
%newret = extractvalue { i8, [0 x i8], [0 x i8] } %94, 0
Instruction does not dominate all uses!
%94 = invoke fastcc { i8, [0 x i8], [0 x i8] } @"_ZN3fmt24Formatter$LT$$u{27}a$GT$3pad20h6fcd1b9b2d92a242qjwE"(%"struct.core::fmt::Formatter[#2]"* noalias dereferenceable(96) %1, %str_slice* noalias nocapture dereferenceable(16) %arg.i.i)
to label %_ZN6string18String.fmt..String3fmt20h74aeaff0c04f8a35kCiE.exit unwind label %unwind_ast_45109_.i
%newret1 = extractvalue { i8, [0 x i8], [0 x i8] } %94, 1
Instruction does not dominate all uses!
%94 = invoke fastcc { i8, [0 x i8], [0 x i8] } @"_ZN3fmt24Formatter$LT$$u{27}a$GT$3pad20h6fcd1b9b2d92a242qjwE"(%"struct.core::fmt::Formatter[#2]"* noalias dereferenceable(96) %1, %str_slice* noalias nocapture dereferenceable(16) %arg.i.i)
to label %_ZN6string18String.fmt..String3fmt20h74aeaff0c04f8a35kCiE.exit unwind label %unwind_ast_45109_.i
%newret3 = extractvalue { i8, [0 x i8], [0 x i8] } %94, 2
LLVM ERROR: Broken function found, compilation aborted!
Could not compile `bug_repr`.
To learn more, run the command again with --verbose.
use std::io::File;
fn main() {
let f = File::open(&Path::new("out.ppm"));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment