Skip to content

Commit 1c95f5a

Browse files
committed
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
1 parent 76c87a1 commit 1c95f5a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/librustc_codegen_llvm/debuginfo/metadata.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -1164,7 +1164,11 @@ fn use_enum_fallback(cx: &CodegenCx) -> bool {
11641164
// On MSVC we have to use the fallback mode, because LLVM doesn't
11651165
// lower variant parts to PDB.
11661166
return cx.sess().target.target.options.is_like_msvc
1167-
|| llvm_util::get_major_version() < 7;
1167+
|| llvm_util::get_major_version() < 7
1168+
// LLVM version 7 did not release with an important bug fix;
1169+
// but the required patch is in the equivalent Rust LLVM.
1170+
// See https://github.com/rust-lang/rust/issues/57762.
1171+
|| (llvm_util::get_major_version() == 7 && unsafe { !llvm::LLVMRustIsRustLLVM() });
11681172
}
11691173

11701174
// Describes the members of an enum value: An enum is described as a union of

0 commit comments

Comments
 (0)