Backport patch for gcc bug 87137

This commit is contained in:
Sandro Mani 2018-09-05 13:49:12 +02:00
parent c80a3fb334
commit 47fdccf281
2 changed files with 39 additions and 2 deletions

32
gcc_bug_87137.patch Normal file
View File

@ -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);
}

View File

@ -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 <manisandro@gmail.com> - 8.2.0-3
- Backport patch for gcc#87137
* Wed Aug 08 2018 Sandro Mani <manisandro@gmail.com> - 8.2.0-2
- Add patch for gcc #86593