about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-01-22 11:13:53 -0700
committerTom Tromey <tom@tromey.com>2019-01-22 11:18:01 -0700
commit1c95f5a34c14f08d65cdd198827e3a2fcb63cf39 (patch)
tree0449bb0cb5a8c439bd8a869a5f5484bca46dae6d /src
parent76c87a166fa8ca247855ea6c32465d627d1ead14 (diff)
downloadrust-1c95f5a34c14f08d65cdd198827e3a2fcb63cf39.tar.gz
rust-1c95f5a34c14f08d65cdd198827e3a2fcb63cf39.zip
Fix issue 57762
Issue 57762 points out a compiler crash when the compiler was built
using a stock LLVM 7.  LLVM 7 was released without a necessary fix for
a bug in the DWARF discriminant code.

This patch changes rustc to use the fallback mode on (non-Rust) LLVM 7.

Closes #57762
Diffstat (limited to 'src')
-rw-r--r--src/librustc_codegen_llvm/debuginfo/metadata.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/librustc_codegen_llvm/debuginfo/metadata.rs b/src/librustc_codegen_llvm/debuginfo/metadata.rs
index 6deedd0b5ea..a354eef6887 100644
--- a/src/librustc_codegen_llvm/debuginfo/metadata.rs
+++ b/src/librustc_codegen_llvm/debuginfo/metadata.rs
@@ -1164,7 +1164,11 @@ fn use_enum_fallback(cx: &CodegenCx) -> bool {
     // On MSVC we have to use the fallback mode, because LLVM doesn't
     // lower variant parts to PDB.
     return cx.sess().target.target.options.is_like_msvc
-        || llvm_util::get_major_version() < 7;
+        || llvm_util::get_major_version() < 7
+        // LLVM version 7 did not release with an important bug fix;
+        // but the required patch is in the equivalent Rust LLVM.
+        // See https://github.com/rust-lang/rust/issues/57762.
+        || (llvm_util::get_major_version() == 7 && unsafe { !llvm::LLVMRustIsRustLLVM() });
 }
 
 // Describes the members of an enum value: An enum is described as a union of