Skip to content

Commit

Permalink
Update LLVM to fix miscompiles with -Copt-level=z on Windows
Browse files Browse the repository at this point in the history
Fixes #45034
  • Loading branch information
dotdash committed Nov 12, 2017
1 parent 69ee5a8 commit 1a8c9f8
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/llvm
2 changes: 1 addition & 1 deletion src/rustllvm/llvm-rebuild-trigger
@@ -1,4 +1,4 @@
# If this file is modified, then llvm will be (optionally) cleaned and then rebuilt.
# The actual contents of this file do not matter, but to trigger a change on the
# build bots then the contents should be changed so git updates the mtime.
2017-07-18
2017-11-07
5 changes: 5 additions & 0 deletions src/test/run-make/msvc-opt-minsize/Makefile
@@ -0,0 +1,5 @@
-include ../tools.mk

all:
$(RUSTC) foo.rs -Copt-level=z 2>&1
$(call RUN,foo)
29 changes: 29 additions & 0 deletions src/test/run-make/msvc-opt-minsize/foo.rs
@@ -0,0 +1,29 @@
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(test)]
extern crate test;

fn foo(x: i32, y: i32) -> i64 {
(x + y) as i64
}

#[inline(never)]
fn bar() {
let _f = Box::new(0);
// This call used to trigger an LLVM bug in opt-level z where the base
// pointer gets corrupted, see issue #45034
let y: fn(i32, i32) -> i64 = test::black_box(foo);
test::black_box(y(1, 2));
}

fn main() {
bar();
}

0 comments on commit 1a8c9f8

Please sign in to comment.