From 47fdccf281ca93a1d1e6ff402b232e21f7fb914b Mon Sep 17 00:00:00 2001 From: Sandro Mani Date: Wed, 5 Sep 2018 13:49:12 +0200 Subject: [PATCH] Backport patch for gcc bug 87137 --- gcc_bug_87137.patch | 32 ++++++++++++++++++++++++++++++++ mingw-gcc.spec | 9 +++++++-- 2 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 gcc_bug_87137.patch diff --git a/gcc_bug_87137.patch b/gcc_bug_87137.patch new file mode 100644 index 0000000..f1d0d2b --- /dev/null +++ b/gcc_bug_87137.patch @@ -0,0 +1,32 @@ +diff -rupN gcc-8.2.0/gcc/stor-layout.c gcc-8.2.0-new/gcc/stor-layout.c +--- gcc-8.2.0/gcc/stor-layout.c 2018-02-28 18:17:29.000000000 +0100 ++++ gcc-8.2.0-new/gcc/stor-layout.c 2018-09-05 13:08:01.467976189 +0200 +@@ -1685,14 +1685,21 @@ place_field (record_layout_info rli, tre + { + rli->bitpos = size_binop (PLUS_EXPR, rli->bitpos, DECL_SIZE (field)); + +- /* If we ended a bitfield before the full length of the type then +- pad the struct out to the full length of the last type. */ +- if ((DECL_CHAIN (field) == NULL +- || TREE_CODE (DECL_CHAIN (field)) != FIELD_DECL) +- && DECL_BIT_FIELD_TYPE (field) ++ /* If FIELD is the last field and doesn't end at the full length ++ of the type then pad the struct out to the full length of the ++ last type. */ ++ if (DECL_BIT_FIELD_TYPE (field) + && !integer_zerop (DECL_SIZE (field))) +- rli->bitpos = size_binop (PLUS_EXPR, rli->bitpos, +- bitsize_int (rli->remaining_in_alignment)); ++ { ++ /* We have to scan, because non-field DECLS are also here. */ ++ tree probe = field; ++ while ((probe = DECL_CHAIN (probe))) ++ if (TREE_CODE (probe) == FIELD_DECL) ++ break; ++ if (!probe) ++ rli->bitpos = size_binop (PLUS_EXPR, rli->bitpos, ++ bitsize_int (rli->remaining_in_alignment)); ++ } + + normalize_rli (rli); + } diff --git a/mingw-gcc.spec b/mingw-gcc.spec index 1a1e7b2..129668f 100644 --- a/mingw-gcc.spec +++ b/mingw-gcc.spec @@ -32,7 +32,7 @@ Name: mingw-gcc Version: 8.2.0 -Release: 2%{?snapshot_date:.svn.%{snapshot_date}.r%{snapshot_rev}}%{?dist} +Release: 3%{?snapshot_date:.svn.%{snapshot_date}.r%{snapshot_rev}}%{?dist} Summary: MinGW Windows cross-compiler (GCC) for C License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions @@ -43,8 +43,10 @@ Source0: ftp://ftp.nluug.nl/mirror/languages/gcc/snapshots/7-%{snapshot_d Source0: ftp://ftp.gnu.org/gnu/gcc/gcc-%{version}/gcc-%{version}.tar.xz %endif -# Fix ICE, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86593 +# Backport fix for ICE, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86593 Patch0: gcc_bug_86593.patch +# Backport fix for incorrect code generation, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87137 +Patch1: gcc_bug_87137.patch BuildRequires: gcc-c++ BuildRequires: texinfo @@ -709,6 +711,9 @@ rm -f $RPM_BUILD_ROOT%{_bindir}/%{mingw64_target}-%{mingw64_target}-* %changelog +* Wed Sep 05 2018 Sandro Mani - 8.2.0-3 +- Backport patch for gcc#87137 + * Wed Aug 08 2018 Sandro Mani - 8.2.0-2 - Add patch for gcc #86593