From e563ce161d65d151d463c1e647c127386f9a92c8 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 14 Nov 2018 11:51:04 +0100 Subject: [PATCH] Fix the misscompilation issue causing rustc to crash (Closes: #913271) Might cause some ABI issues but no real good solution. See https://bugs.llvm.org/show_bug.cgi?id=39427 --- debian/changelog | 3 +++ debian/patches/pr39427-misscompile.diff | 29 +++++++++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 33 insertions(+) create mode 100644 debian/patches/pr39427-misscompile.diff diff --git a/debian/changelog b/debian/changelog index db86131b..26d86aaf 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,9 @@ llvm-toolchain-7 (1:7.0.1~+rc2-3) unstable; urgency=medium * Try to integrate a pach to make pch reproducible Thanks to Rebecca Palmer for the patch (Closes: #877359) + * Fix the misscompilation issue causing rustc to crash (Closes: #913271) + Might cause some ABI issues but no real good solution. + See https://bugs.llvm.org/show_bug.cgi?id=39427 -- Sylvestre Ledru Thu, 08 Nov 2018 20:50:39 +0100 diff --git a/debian/patches/pr39427-misscompile.diff b/debian/patches/pr39427-misscompile.diff new file mode 100644 index 00000000..797e02b1 --- /dev/null +++ b/debian/patches/pr39427-misscompile.diff @@ -0,0 +1,29 @@ +Index: llvm-toolchain-7-7/include/llvm/ADT/Optional.h +=================================================================== +--- llvm-toolchain-7-7.orig/include/llvm/ADT/Optional.h ++++ llvm-toolchain-7-7/include/llvm/ADT/Optional.h +@@ -108,24 +108,6 @@ template st + } + }; + +-#if !defined(__GNUC__) || defined(__clang__) // GCC up to GCC7 miscompiles this. +-/// Storage for trivially copyable types only. +-template struct OptionalStorage { +- AlignedCharArrayUnion storage; +- bool hasVal = false; +- +- OptionalStorage() = default; +- +- OptionalStorage(const T &y) : hasVal(true) { new (storage.buffer) T(y); } +- OptionalStorage &operator=(const T &y) { +- *reinterpret_cast(storage.buffer) = y; +- hasVal = true; +- return *this; +- } +- +- void reset() { hasVal = false; } +-}; +-#endif + } // namespace optional_detail + + template class Optional { diff --git a/debian/patches/series b/debian/patches/series index fcce361e..b848aae0 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -88,3 +88,4 @@ remove-apple-clang-manpage.diff mips-rdhwr.diff clang-arm-default-vfp3-on-armv7a.patch reproducible-pch.diff +pr39427-misscompile.diff