Compare commits

...

21 Commits
master ... f27

Author SHA1 Message Date
Jakub Jelinek afc2075a42 7.3.1-5 2018-03-03 17:08:39 +01:00
Jakub Jelinek 48c591735c 7.3.1-5 2018-03-03 16:03:49 +01:00
Jakub Jelinek 4e884feede 7.3.1-5 2018-03-03 16:02:47 +01:00
Jakub Jelinek e80913359b Merge branch 'f27' of ssh://pkgs.fedoraproject.org/rpms/gcc into f27 2018-03-03 16:02:12 +01:00
Jakub Jelinek 153fd5db2c 7.3.1-3 2018-03-03 15:56:22 +01:00
Richard W.M. Jones 3c65313112 Disable multilib on riscv64.
(cherry picked from commit ca8c0f7dc6)
2018-02-05 09:07:30 +00:00
Jeff Law b8ffb32f78 - fix -fstack-clash-protection codegen issue on 32 bit x86
(#1540221, PR target/84128)
2018-02-01 09:32:34 -07:00
Jakub Jelinek 872459a238 7.3.1-2 2018-01-30 13:24:33 +01:00
Jakub Jelinek 652d93f4cc 7.3.1-2 2018-01-30 11:26:25 +01:00
Jakub Jelinek c587503828 7.3.1-1 2018-01-25 11:49:48 +01:00
Jeff Law 7288333279 - Fix -fstack-clash-protection codegen issue on 32 bit x86 (#1536555) 2018-01-25 11:48:49 +01:00
Jakub Jelinek deb3648890 7.2.1-7 2018-01-17 03:49:34 +01:00
Jakub Jelinek bf725905e9 7.2.1-7 2018-01-17 00:44:27 +01:00
Jakub Jelinek c7d69b118f 7.2.1-6 2018-01-04 19:51:41 +01:00
Jakub Jelinek 2678e30d91 7.2.1-5 2018-01-02 00:28:28 +01:00
Jakub Jelinek 3597b2c793 7.2.1-5 2018-01-02 00:28:17 +01:00
Jakub Jelinek 595e84a5d2 7.2.1-5 2018-01-01 14:19:56 +01:00
Marek Polacek 1c395ab120 Delete gcc7-rh1512529-18.patch. 2017-11-30 20:10:46 +01:00
Marek Polacek 5687bc9b1d Bring the branch on par with master. 2017-11-30 20:07:35 +01:00
Jeff Law 86983dda69 - Fix problem with large outgoing args and -fstack-clash-protection
on aarch64 (#1518823)
2017-11-29 12:00:50 -07:00
Jeff Law 51469f73cc - Backport -fstack-clash-protection from development trunk (#1512529) 2017-11-28 09:00:50 -07:00
14 changed files with 2959 additions and 652 deletions

6
.gitignore vendored
View File

@ -24,3 +24,9 @@
/gcc-7.1.1-20170802.tar.bz2
/gcc-7.2.1-20170829.tar.bz2
/gcc-7.2.1-20170915.tar.bz2
/gcc-7.2.1-20180101.tar.bz2
/gcc-7.2.1-20180104.tar.bz2
/gcc-7.2.1-20180117.tar.bz2
/gcc-7.3.1-20180125.tar.bz2
/gcc-7.3.1-20180130.tar.bz2
/gcc-7.3.1-20180303.tar.bz2

209
gcc.spec
View File

@ -1,16 +1,20 @@
%global DATE 20170915
%global SVNREV 252800
%global gcc_version 7.2.1
%global DATE 20180303
%global SVNREV 258210
%global gcc_version 7.3.1
%global gcc_major 7
# Note, gcc_release must be integer, if you want to add suffixes to
# %{release}, append them after %{gcc_release} on Release: line.
%global gcc_release 2
%global gcc_release 5
%global nvptx_tools_gitrev c28050f60193b3b95a18866a96f03334e874e78f
%global nvptx_newlib_gitrev aadc8eb0ec43b7cd0dd2dfb484bae63c8b05ef24
%global _unpackaged_files_terminate_build 0
%global _performance_build 1
# Hardening slows the compiler way too much.
%undefine _hardened_build
%if 0%{?fedora} > 27
# Until annobin is fixed (#1519165).
%undefine _annotated_build
%endif
%global multilib_64_archs sparc64 ppc64 ppc64p7 s390x x86_64
%ifarch %{ix86} x86_64 ia64 ppc %{power64} alpha s390x %{arm} aarch64
%global build_ada 1
@ -91,7 +95,7 @@
%ifarch x86_64
%global multilib_32_arch i686
%endif
Summary: Various compilers (C, C++, Objective-C, Java, ...)
Summary: Various compilers (C, C++, Objective-C, ...)
Name: gcc
Version: %{gcc_version}
Release: %{gcc_release}%{?dist}
@ -101,7 +105,7 @@ License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2
Group: Development/Languages
# The source for this package was pulled from upstream's vcs. Use the
# following commands to generate the tarball:
# svn export svn://gcc.gnu.org/svn/gcc/branches/redhat/gcc-6-branch@%{SVNREV} gcc-%{version}-%{DATE}
# svn export svn://gcc.gnu.org/svn/gcc/branches/redhat/gcc-7-branch@%{SVNREV} gcc-%{version}-%{DATE}
# tar cf - gcc-%{version}-%{DATE} | bzip2 -9 > gcc-%{version}-%{DATE}.tar.bz2
Source0: gcc-%{version}-%{DATE}.tar.bz2
# The source for nvptx-tools package was pulled from upstream's vcs. Use the
@ -221,7 +225,6 @@ Provides: bundled(libiberty)
Provides: gcc(major) = %{gcc_major}
Patch0: gcc7-hack.patch
Patch1: gcc7-ppc32-retaddr.patch
Patch2: gcc7-i386-libgomp.patch
Patch3: gcc7-sparc-config-detection.patch
Patch4: gcc7-libgomp-omp_h-multilib.patch
@ -232,16 +235,16 @@ Patch8: gcc7-no-add-needed.patch
Patch9: gcc7-aarch64-async-unw-tables.patch
Patch10: gcc7-foffload-default.patch
Patch11: gcc7-Wno-format-security.patch
Patch12: gcc7-pr81314.patch
Patch13: gcc7-pr81325.patch
Patch14: gcc7-pr82112-1.patch
Patch15: gcc7-pr82112-2.patch
Patch16: gcc7-pr81929.patch
Patch12: gcc7-aarch64-sanitizer-fix.patch
Patch13: gcc7-rh1512529-aarch64.patch
Patch14: gcc7-pr84524.patch
Patch15: gcc7-pr84128.patch
Patch1000: nvptx-tools-no-ptxas.patch
Patch1001: nvptx-tools-build.patch
Patch1002: nvptx-tools-glibc.patch
# On ARM EABI systems, we do want -gnueabi to be part of the
# target triple.
%ifnarch %{arm}
@ -259,6 +262,23 @@ Patch1002: nvptx-tools-glibc.patch
%global gcc_target_platform %{_target_platform}
%endif
%if %{?fedora} >= 27
%if %{build_go}
# Avoid stripping these libraries and binaries.
%global __os_install_post \
chmod 644 %{buildroot}%{_prefix}/%{_lib}/libgo.so.11.* \
chmod 644 %{buildroot}%{_prefix}/bin/go.gcc \
chmod 644 %{buildroot}%{_prefix}/bin/gofmt.gcc \
chmod 644 %{buildroot}%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/cgo \
%__os_install_post \
chmod 755 %{buildroot}%{_prefix}/%{_lib}/libgo.so.11.* \
chmod 755 %{buildroot}%{_prefix}/bin/go.gcc \
chmod 755 %{buildroot}%{_prefix}/bin/gofmt.gcc \
chmod 755 %{buildroot}%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/cgo \
%{nil}
%endif
%endif
%description
The gcc package contains the GNU Compiler Collection version 7.
You'll need this package in order to compile C code.
@ -773,6 +793,7 @@ NVidia PTX. OpenMP and OpenACC programs linked with -fopenmp will
by default add PTX code into the binaries, which can be offloaded
to NVidia PTX capable devices if available.
%if 0%{?fedora} < 27
%if 0%{?_enable_debug_packages}
%define debug_package %{nil}
%global __debug_package 1
@ -807,11 +828,11 @@ package or when debugging this package.
%files base-debuginfo -f debugfiles-base.list
%endif
%endif
%prep
%setup -q -n gcc-%{version}-%{DATE} -a 1 -a 2
%patch0 -p0 -b .hack~
%patch1 -p0 -b .ppc32-retaddr~
%patch2 -p0 -b .i386-libgomp~
%patch3 -p0 -b .sparc-config-detection~
%patch4 -p0 -b .libgomp-omp_h-multilib~
@ -826,11 +847,12 @@ package or when debugging this package.
%patch9 -p0 -b .aarch64-async-unw-tables~
%patch10 -p0 -b .foffload-default~
%patch11 -p0 -b .Wno-format-security~
%patch12 -p0 -b .pr81314~
%patch13 -p0 -b .pr81325~
%patch14 -p0 -b .pr82112-1~
%patch15 -p0 -b .pr82112-2~
%patch16 -p0 -b .pr81929~
%if 0%{?fedora} > 27
%patch12 -p0 -b .aarch64-sanitizer-fix~
%endif
%patch13 -p0 -b .rh1512529-aarch64~
%patch14 -p0 -b .pr84524~
%patch15 -p0 -b .pr84128~
cd nvptx-tools-%{nvptx_tools_gitrev}
%patch1000 -p1 -b .nvptx-tools-no-ptxas~
@ -838,6 +860,7 @@ cd nvptx-tools-%{nvptx_tools_gitrev}
%patch1002 -p1 -b .nvptx-tools-glibc~
cd ..
%if 0%{?fedora} < 27
%if 0%{?_enable_debug_packages}
mkdir dwz-wrapper
if [ -f /usr/bin/dwz ]; then
@ -938,6 +961,7 @@ fi
EOF
chmod 755 split-debuginfo.sh
%endif
%endif
echo 'Red Hat %{version}-%{gcc_release}' > gcc/DEV-PHASE
@ -1049,7 +1073,7 @@ CONFIGURE_OPTS="\
%ifarch ppc64le
--enable-targets=powerpcle-linux \
%endif
%ifarch ppc64le %{mips}
%ifarch ppc64le %{mips} riscv64
--disable-multilib \
%else
--enable-multilib \
@ -3101,10 +3125,10 @@ fi
%if %{build_go}
%files go
%ghost %{_prefix}/bin/go
%{_prefix}/bin/go.gcc
%attr(755,root,root) %{_prefix}/bin/go.gcc
%{_prefix}/bin/gccgo
%ghost %{_prefix}/bin/gofmt
%{_prefix}/bin/gofmt.gcc
%attr(755,root,root) %{_prefix}/bin/gofmt.gcc
%{_mandir}/man1/gccgo.1*
%{_mandir}/man1/go.1*
%{_mandir}/man1/gofmt.1*
@ -3115,7 +3139,7 @@ fi
%dir %{_prefix}/libexec/gcc/%{gcc_target_platform}
%dir %{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}
%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/go1
%{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/cgo
%attr(755,root,root) %{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_major}/cgo
%ifarch sparcv9 ppc
%dir %{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64
%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_major}/64/libgo.so
@ -3141,7 +3165,7 @@ fi
%doc rpm.doc/go/*
%files -n libgo
%{_prefix}/%{_lib}/libgo.so.11*
%attr(755,root,root) %{_prefix}/%{_lib}/libgo.so.11*
%doc rpm.doc/libgo/*
%files -n libgo-devel
@ -3248,6 +3272,145 @@ fi
%endif
%changelog
* Sat Mar 3 2018 Jakub Jelinek <jakub@redhat.com> 7.3.1-5
- update from the 7 branch
- PRs ada/84277, bootstrap/80867, bootstrap/82916, bootstrap/84017,
c++/71569, c++/71784, c++/81589, c++/81853, c++/81860, c++/82664,
c++/82764, c++/83227, c++/83659, c++/83817, c++/83824, c++/83835,
c++/83958, c++/83990, c++/83993, c++/84015, c++/84031, c++/84045,
c++/84082, c++/84151, c++/84192, c++/84341, c++/84420, c++/84430,
c++/84441, c++/84444, c++/84445, c++/84448, c++/84449, c++/84489,
c++/84496, c++/84520, c++/84556, c++/84557, c++/84558, c/82210,
fortran/30792, fortran/35299, fortran/54223, fortran/68560,
fortran/78238, fortran/81116, fortran/82007, fortran/82049,
fortran/82994, fortran/83633, fortran/84116, fortran/84270,
fortran/84276, fortran/84346, fortran/84418, fortran/84495,
fortran/84506, fortran/84511, inline-asm/84625, ipa/84425, ipa/84628,
libgfortran/84412, libgomp/84096, libstdc++/81797, libstdc++/84532,
libstdc++/84671, middle-end/83945, middle-end/83977, middle-end/84040,
preprocessor/69869, preprocessor/83722, rtl-optimization/83496,
rtl-optimization/83986, rtl-optimization/84071,
rtl-optimization/84123, rtl-optimization/84308, sanitizer/70875,
sanitizer/83987, sanitizer/84285, target/56010, target/79242,
target/79975, target/81228, target/82096, target/83370, target/83743,
target/83758, target/83790, target/83930, target/84039, target/84089,
target/84113, target/84154, target/84279, target/84388, target/84390,
target/84530, target/PR84295, tree-optimization/81661,
tree-optimization/82795, tree-optimization/83605,
tree-optimization/84117, tree-optimization/84190,
tree-optimization/84233, tree-optimization/84503
- fix AVX512BW wrong-code bug (PR target/84524)
- fix go provides/requires (#1545071)
* Mon Feb 5 2018 Richard W.M. Jones <rjones@redhat.com> 7.3.1-4
- disable multilib on riscv64
* Thu Feb 1 2018 Jeff Law <law@redhat.com> 7.3.1-3
- fix -fstack-clash-protection codegen issue on 32 bit x86
(#1540221, PR target/84128)
* Tue Jan 30 2018 Jakub Jelinek <jakub@redhat.com> 7.3.1-2
- update from the 7 branch
- PRs c++/82461, c++/82878, libstdc++/81076, libstdc++/83658,
libstdc++/83830, libstdc++/83833, rtl-optimization/83985, target/68467,
target/81763, target/83399, target/83862, target/83905, target/84033
- fix -fstack-clash-protection ICE with -mtune=i686 (#1538648, PR target/84064)
* Thu Jan 25 2018 Jakub Jelinek <jakub@redhat.com> 7.3.1-1
- update from the 7 branch
- 7.3 release
- PRs c++/81843, c++/82331, c++/82760, fortran/80768, fortran/83864,
fortran/83874, fortran/83900, ipa/82352, ipa/83549, libstdc++/83834,
middle-end/81782, rtl-optimization/81443, target/80870, target/83687,
target/83946, tree-optimization/81877, tree-optimization/83552
* Wed Jan 24 2018 Jeff Law <law@redhat.com> 7.2.1-8
- fix -fstack-clash-protection codegen issue on 32 bit x86 (#1536555)
* Wed Jan 17 2018 Jakub Jelinek <jakub@redhat.com> 7.2.1-7
- update from the 7 branch
- PRs fortran/78814, fortran/82367, fortran/82841, fortran/83093,
fortran/83679, libgfortran/83811, libstdc++/79283, libstdc++/83279,
libstdc++/83598, libstdc++/83600, libstdc++/83626, middle-end/83713,
preprocessor/83492, rtl-optimization/83424, rtl-optimization/83565,
target/81481, target/81819, target/81821, target/82975, target/83330,
target/83628, target/83629, target/83677, target/83839,
testsuite/77734
- x86 retpoline support
- comment out gcc-debuginfo/gcc-base-debuginfo splitting hacks for f27 and
later (#1517259)
* Thu Jan 4 2018 Jakub Jelinek <jakub@redhat.com> 7.2.1-6
- update from the 7 branch
- PRs c++/83556, fortran/83650, libgfortran/83649
- backport fixes for two -fstack-clash-protection bugs from the trunk
(PRs middle-end/83654, target/83641)
- commit -fstack-clash-protection patches except aarch64 to
redhat/gcc-7-branch instead of applying them as patches in the spec file
* Mon Jan 1 2018 Jakub Jelinek <jakub@redhat.com> 7.2.1-5
- update from the 7 branch
- PRs ada/82393, bootstrap/83439, c++/70029, c++/79650, c++/80259,
c++/80767, c++/80935, c++/81197, c++/81212, c++/81236, c++/81525,
c++/81671, c++/81675, c++/81702, c++/81888, c++/82030, c++/82085,
c++/82159, c++/82299, c++/82373, c++/82406, c++/82560, c++/82781,
c++/83059, c++/83116, c++/83205, c++/83217, c++/83553, c/81875,
c/82234, c/82340, c/83448, debug/83084, driver/81829, fortran/52832,
fortran/67543, fortran/69739, fortran/78152, fortran/78512,
fortran/78619, fortran/78641, fortran/78686, fortran/79072,
fortran/79795, fortran/80118, fortran/80120, fortran/80554,
fortran/80850, fortran/81048, fortran/81304, fortran/81735,
fortran/81758, fortran/81841, fortran/81903, fortran/82121,
fortran/82312, fortran/82796, fortran/82934, fortran/83021,
fortran/83191, fortran/83436, fortran/83548, gcov-profile/82457,
gcov-profile/82633, go/80914, ipa/82801, ipa/82808, ipa/83346,
libfortran/82233, libgcc/82635, libgfortran/78387, libgfortran/78549,
libgfortran/81937, libgfortran/81938, libgfortran/83168,
libgfortran/83191, libgfortran/83225, libgfortran/83613,
libstdc++/59568, libstdc++/79433, libstdc++/81395, libstdc++/82254,
libstdc++/82262, libstdc++/82481, libstdc++/82522, libstdc++/82685,
libstdc++/83134, libstdc++/83226, libstdc++/83395, libstdc++/83427,
lto/82027, middle-end/60580, middle-end/80295, middle-end/82128,
middle-end/82253, middle-end/82556, middle-end/82765,
middle-end/83471, middle-end/83608, middle-end/83609,
middle-end/83623, rtl-optimization/64682, rtl-optimization/69567,
rtl-optimization/69737, rtl-optimization/80747,
rtl-optimization/81553, rtl-optimization/81803,
rtl-optimization/82044, rtl-optimization/82192,
rtl-optimization/82602, rtl-optimization/82621,
rtl-optimization/82683, rtl-optimization/83512, sanitizer/81715,
sanitizer/82379, sanitizer/82545, sanitizer/82595, sanitizer/82792,
sanitizer/82869, sanitizer/83014, target/39570, target/66488,
target/71727, target/71951, target/77480, target/77687, target/78643,
target/80583, target/80600, target/80819, target/81288, target/81906,
target/81959, target/81996, target/82274, target/82445, target/82524,
target/82703, target/82717, target/82772, target/82880, target/82941,
target/82942, target/82990, target/83111, target/83387, target/83467,
tree-optimization/80631, tree-optimization/81790,
tree-optimization/82042, tree-optimization/82060,
tree-optimization/82084, tree-optimization/82102,
tree-optimization/82108, tree-optimization/82244,
tree-optimization/82276, tree-optimization/82285,
tree-optimization/82291, tree-optimization/82337,
tree-optimization/82402, tree-optimization/82436,
tree-optimization/82549, tree-optimization/82603,
tree-optimization/82697, tree-optimization/82726,
tree-optimization/82902, tree-optimization/82985,
tree-optimization/83198, tree-optimization/83269,
tree-optimization/83521, tree-optimization/83523
- fix debuginfo for forward declared C structs (#1500862, PR debug/83550)
- fix sccvn ICE (#1506809, PR tree-optimization/82264)
- fix ICE in dwarf2out force_type_die (#1516576, #1516577, PR debug/82155)
- fix power6 ICE in store_data_bypass_p (#1522675, PR target/80101)
- fix replace_placeholders (PR c++/83556)
* Wed Nov 29 2017 Jeff Law <law@redhat.com> 7.2.1-4
- fix problem with large outgoing args and -fstack-clash-protection
on aarch64 (#1518823)
* Tue Nov 28 2017 Jeff Law <law@redhat.com> 7.2.1-3
- backport -fstack-clash-protection from development trunk (#1512529)
* Fri Sep 15 2017 Jakub Jelinek <jakub@redhat.com> 7.2.1-2
- update from the 7 branch
- PRs ada/62235, ada/79441, ada/79542, bootstrap/81926, c++/81355,

View File

@ -0,0 +1,11 @@
--- libsanitizer/sanitizer_common/sanitizer_linux.cc
+++ libsanitizer/sanitizer_common/sanitizer_linux.cc
@@ -1262,7 +1262,7 @@ struct __sanitizer_esr_context {
static bool Aarch64GetESR(ucontext_t *ucontext, u64 *esr) {
static const u32 kEsrMagic = 0x45535201;
- u8 *aux = ucontext->uc_mcontext.__reserved;
+ u8 *aux = ucontext->uc_mcontext.__glibc_reserved1;
while (true) {
_aarch64_ctx *ctx = (_aarch64_ctx *)aux;
if (ctx->size == 0) break;

View File

@ -4,7 +4,7 @@
<a class="link" href="http://www.fsf.org/" target="_top">FSF
</a>
</p><p>
+ Release 7.2.1
+ Release 7.3.1
+ </p><p>
Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation
@ -17,7 +17,7 @@
</p><p>
- The API documentation, rendered into HTML, can be viewed online
+ The API documentation, rendered into HTML, can be viewed locally
+ <a class="link" href="api/index.html" target="_top">for the 7.2.1 release</a>,
+ <a class="link" href="api/index.html" target="_top">for the 7.3.1 release</a>,
+ online
<a class="link" href="http://gcc.gnu.org/onlinedocs/" target="_top">for each GCC release</a>
and

View File

@ -1,87 +0,0 @@
2005-11-28 Jakub Jelinek <jakub@redhat.com>
* config/rs6000/rs6000.c (rs6000_return_addr): If COUNT == 0,
read word RETURN_ADDRESS_OFFSET bytes above arg_pointer_rtx
instead of doing an extran indirection from frame_pointer_rtx.
* gcc.dg/20051128-1.c: New test.
--- gcc/config/rs6000/rs6000.c.jj 2005-11-26 14:38:01.000000000 +0100
+++ gcc/config/rs6000/rs6000.c 2005-11-28 20:32:18.000000000 +0100
@@ -20970,18 +20970,22 @@ rs6000_return_addr (int count, rtx frame
if (count != 0
|| ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_DARWIN) && flag_pic))
{
+ rtx x;
cfun->machine->ra_needs_full_frame = 1;
- return
- gen_rtx_MEM
- (Pmode,
- memory_address
- (Pmode,
- plus_constant (Pmode,
- copy_to_reg
- (gen_rtx_MEM (Pmode,
- memory_address (Pmode, frame))),
- RETURN_ADDRESS_OFFSET)));
+ if (count == 0)
+ {
+ gcc_assert (frame == frame_pointer_rtx);
+ x = arg_pointer_rtx;
+ }
+ else
+ {
+ x = memory_address (Pmode, frame);
+ x = copy_to_reg (gen_rtx_MEM (Pmode, x));
+ }
+
+ x = plus_constant (Pmode, x, RETURN_ADDRESS_OFFSET);
+ return gen_rtx_MEM (Pmode, memory_address (Pmode, x));
}
cfun->machine->ra_need_lr = 1;
--- gcc/testsuite/gcc.dg/20051128-1.c.jj 2005-10-10 11:21:41.096999000 +0200
+++ gcc/testsuite/gcc.dg/20051128-1.c 2005-11-28 12:30:57.000000000 +0100
@@ -0,0 +1,41 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fpic" } */
+
+extern void exit (int);
+extern void abort (void);
+
+int b;
+
+struct A
+{
+ void *pad[147];
+ void *ra, *h;
+ long o;
+};
+
+void
+__attribute__((noinline))
+foo (struct A *a, void *x)
+{
+ __builtin_memset (a, 0, sizeof (a));
+ if (!b)
+ exit (0);
+}
+
+void
+__attribute__((noinline))
+bar (void)
+{
+ struct A a;
+
+ __builtin_unwind_init ();
+ foo (&a, __builtin_return_address (0));
+}
+
+int
+main (void)
+{
+ bar ();
+ abort ();
+ return 0;
+}

View File

@ -1,72 +0,0 @@
2017-09-15 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
2017-09-14 Jakub Jelinek <jakub@redhat.com>
PR c++/81314
* cp-gimplify.c (omp_var_to_track): Look through references.
(omp_cxx_notice_variable): Likewise.
* testsuite/libgomp.c++/pr81314.C: New test.
--- gcc/cp/cp-gimplify.c (revision 252769)
+++ gcc/cp/cp-gimplify.c (revision 252770)
@@ -895,6 +895,8 @@ omp_var_to_track (tree decl)
tree type = TREE_TYPE (decl);
if (is_invisiref_parm (decl))
type = TREE_TYPE (type);
+ else if (TREE_CODE (type) == REFERENCE_TYPE)
+ type = TREE_TYPE (type);
while (TREE_CODE (type) == ARRAY_TYPE)
type = TREE_TYPE (type);
if (type == error_mark_node || !CLASS_TYPE_P (type))
@@ -947,6 +949,8 @@ omp_cxx_notice_variable (struct cp_gener
tree type = TREE_TYPE (decl);
if (is_invisiref_parm (decl))
type = TREE_TYPE (type);
+ else if (TREE_CODE (type) == REFERENCE_TYPE)
+ type = TREE_TYPE (type);
while (TREE_CODE (type) == ARRAY_TYPE)
type = TREE_TYPE (type);
get_copy_ctor (type, tf_none);
--- libgomp/testsuite/libgomp.c++/pr81314.C (nonexistent)
+++ libgomp/testsuite/libgomp.c++/pr81314.C (revision 252770)
@@ -0,0 +1,38 @@
+// PR c++/81314
+// { dg-do link }
+
+template <int N>
+struct S {
+ S () { s = 0; }
+ S (const S &x) { s = x.s; }
+ ~S () {}
+ int s;
+};
+
+void
+foo (S<2> &x)
+{
+ #pragma omp taskloop
+ for (int i = 0; i < 100; ++i)
+ x.s++;
+}
+
+void
+bar (S<3> &x)
+{
+ #pragma omp task
+ x.s++;
+}
+
+int
+main ()
+{
+ S<2> s;
+ S<3> t;
+ #pragma omp parallel
+ #pragma omp master
+ {
+ foo (s);
+ bar (t);
+ }
+}

View File

@ -1,199 +0,0 @@
2017-09-15 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
2017-09-14 Jakub Jelinek <jakub@redhat.com>
PR target/81325
* cfgbuild.c (find_bb_boundaries): Ignore debug insns in decisions
if and where to split a bb, except for splitting before debug insn
sequences followed by non-label real insn. Delete debug insns
in between basic blocks.
* g++.dg/cpp0x/pr81325.C: New test.
--- gcc/cfgbuild.c (revision 252751)
+++ gcc/cfgbuild.c (revision 252752)
@@ -442,9 +442,10 @@ find_bb_boundaries (basic_block bb)
rtx_insn *end = BB_END (bb), *x;
rtx_jump_table_data *table;
rtx_insn *flow_transfer_insn = NULL;
+ rtx_insn *debug_insn = NULL;
edge fallthru = NULL;
- if (insn == BB_END (bb))
+ if (insn == end)
return;
if (LABEL_P (insn))
@@ -455,27 +456,49 @@ find_bb_boundaries (basic_block bb)
{
enum rtx_code code = GET_CODE (insn);
+ if (code == DEBUG_INSN)
+ {
+ if (flow_transfer_insn && !debug_insn)
+ debug_insn = insn;
+ }
/* In case we've previously seen an insn that effects a control
flow transfer, split the block. */
- if ((flow_transfer_insn || code == CODE_LABEL)
- && inside_basic_block_p (insn))
+ else if ((flow_transfer_insn || code == CODE_LABEL)
+ && inside_basic_block_p (insn))
{
- fallthru = split_block (bb, PREV_INSN (insn));
+ rtx_insn *prev = PREV_INSN (insn);
+
+ /* If the first non-debug inside_basic_block_p insn after a control
+ flow transfer is not a label, split the block before the debug
+ insn instead of before the non-debug insn, so that the debug
+ insns are not lost. */
+ if (debug_insn && code != CODE_LABEL && code != BARRIER)
+ prev = PREV_INSN (debug_insn);
+ fallthru = split_block (bb, prev);
if (flow_transfer_insn)
{
BB_END (bb) = flow_transfer_insn;
+ rtx_insn *next;
/* Clean up the bb field for the insns between the blocks. */
for (x = NEXT_INSN (flow_transfer_insn);
x != BB_HEAD (fallthru->dest);
- x = NEXT_INSN (x))
- if (!BARRIER_P (x))
- set_block_for_insn (x, NULL);
+ x = next)
+ {
+ next = NEXT_INSN (x);
+ /* Debug insns should not be in between basic blocks,
+ drop them on the floor. */
+ if (DEBUG_INSN_P (x))
+ delete_insn (x);
+ else if (!BARRIER_P (x))
+ set_block_for_insn (x, NULL);
+ }
}
bb = fallthru->dest;
remove_edge (fallthru);
flow_transfer_insn = NULL;
+ debug_insn = NULL;
if (code == CODE_LABEL && LABEL_ALT_ENTRY_P (insn))
make_edge (ENTRY_BLOCK_PTR_FOR_FN (cfun), bb, 0);
}
@@ -498,17 +521,23 @@ find_bb_boundaries (basic_block bb)
/* In case expander replaced normal insn by sequence terminating by
return and barrier, or possibly other sequence not behaving like
ordinary jump, we need to take care and move basic block boundary. */
- if (flow_transfer_insn)
+ if (flow_transfer_insn && flow_transfer_insn != end)
{
BB_END (bb) = flow_transfer_insn;
/* Clean up the bb field for the insns that do not belong to BB. */
- x = flow_transfer_insn;
- while (x != end)
+ rtx_insn *next;
+ for (x = NEXT_INSN (flow_transfer_insn); ; x = next)
{
- x = NEXT_INSN (x);
- if (!BARRIER_P (x))
+ next = NEXT_INSN (x);
+ /* Debug insns should not be in between basic blocks,
+ drop them on the floor. */
+ if (DEBUG_INSN_P (x))
+ delete_insn (x);
+ else if (!BARRIER_P (x))
set_block_for_insn (x, NULL);
+ if (x == end)
+ break;
}
}
--- gcc/testsuite/g++.dg/cpp0x/pr81325.C (nonexistent)
+++ gcc/testsuite/g++.dg/cpp0x/pr81325.C (revision 252752)
@@ -0,0 +1,84 @@
+// PR target/81325
+// { dg-do compile { target c++11 } }
+// { dg-options "-O2 -fcompare-debug" }
+
+struct A { A(const char *, const int & = 0); };
+template <typename> struct B;
+template <typename> struct C {
+ int _M_i;
+ void m_fn1() { __atomic_fetch_add(&_M_i, 0, __ATOMIC_RELAXED); }
+};
+struct D {
+ int *Data;
+ long Length = 0;
+ D(int) : Data() {}
+};
+template <> struct B<int> : C<int> {};
+struct F {
+ B<int> RefCount;
+ void m_fn2() { RefCount.m_fn1(); }
+};
+struct G {
+ F *Obj;
+ G(const G &p1) : Obj(p1.Obj) {
+ if (Obj) {
+ F *a = 0;
+ a->m_fn2();
+ }
+ }
+};
+struct H {
+ int CPlusPlus : 1;
+};
+struct I {
+ enum {} KindId;
+};
+template <typename ResultT, typename ArgT> struct J {
+ void operator()();
+ ResultT operator()(ArgT) {}
+};
+struct K {
+ int AllowBind;
+ I SupportedKind;
+ I RestrictKind;
+ G Implementation;
+};
+struct L {
+ L(int) : Implementation(Implementation) {}
+ K Implementation;
+};
+struct M {
+ int Param1;
+};
+struct N {
+ N(int, L &p2) : Param2(p2) {}
+ L Param2;
+};
+struct O {
+ L m_fn3();
+};
+L ignoringImpCasts(L);
+J<O, L> b;
+L hasName(const A &);
+M hasOverloadedOperatorName(D);
+J<O, int> c;
+struct P {
+ void m_fn4(L, int);
+};
+struct Q {
+ void m_fn5(P *);
+};
+H d;
+void Q::m_fn5(P *p1) {
+ if (!d.CPlusPlus) {
+ c();
+ L e = 0, f = ignoringImpCasts(e);
+ b(ignoringImpCasts(f)).m_fn3();
+ }
+ hasOverloadedOperatorName(0);
+ hasName("");
+ L g = 0;
+ N(0, g);
+ L h(0);
+ p1->m_fn4(h, 0);
+}

View File

@ -1,73 +0,0 @@
2017-09-14 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/81929
* tree.c (struct replace_placeholders_t): Add pset field.
(replace_placeholders_r): Call cp_walk_tree with d->pset as
last argument instead of NULL. Formatting fix.
(replace_placeholders): Add pset variable, add its address
into data. Pass &pset instead of NULL to cp_walk_tree.
* g++.dg/ubsan/pr81929.C: New test.
--- gcc/cp/tree.c.jj 2017-09-12 09:35:47.000000000 +0200
+++ gcc/cp/tree.c 2017-09-14 17:38:07.717064412 +0200
@@ -3063,6 +3063,7 @@ struct replace_placeholders_t
{
tree obj; /* The object to be substituted for a PLACEHOLDER_EXPR. */
bool seen; /* Whether we've encountered a PLACEHOLDER_EXPR. */
+ hash_set<tree> *pset; /* To avoid walking same trees multiple times. */
};
/* Like substitute_placeholder_in_expr, but handle C++ tree codes and
@@ -3085,8 +3086,8 @@ replace_placeholders_r (tree* t, int* wa
case PLACEHOLDER_EXPR:
{
tree x = obj;
- for (; !(same_type_ignoring_top_level_qualifiers_p
- (TREE_TYPE (*t), TREE_TYPE (x)));
+ for (; !same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (*t),
+ TREE_TYPE (x));
x = TREE_OPERAND (x, 0))
gcc_assert (TREE_CODE (x) == COMPONENT_REF);
*t = x;
@@ -3118,8 +3119,7 @@ replace_placeholders_r (tree* t, int* wa
valp = &TARGET_EXPR_INITIAL (*valp);
}
d->obj = subob;
- cp_walk_tree (valp, replace_placeholders_r,
- data_, NULL);
+ cp_walk_tree (valp, replace_placeholders_r, data_, d->pset);
d->obj = obj;
}
*walk_subtrees = false;
@@ -3151,10 +3151,11 @@ replace_placeholders (tree exp, tree obj
return exp;
tree *tp = &exp;
- replace_placeholders_t data = { obj, false };
+ hash_set<tree> pset;
+ replace_placeholders_t data = { obj, false, &pset };
if (TREE_CODE (exp) == TARGET_EXPR)
tp = &TARGET_EXPR_INITIAL (exp);
- cp_walk_tree (tp, replace_placeholders_r, &data, NULL);
+ cp_walk_tree (tp, replace_placeholders_r, &data, &pset);
if (seen_p)
*seen_p = data.seen;
return exp;
--- gcc/testsuite/g++.dg/ubsan/pr81929.C.jj 2017-09-14 17:48:09.052611540 +0200
+++ gcc/testsuite/g++.dg/ubsan/pr81929.C 2017-09-14 17:49:21.644711332 +0200
@@ -0,0 +1,14 @@
+// PR sanitizer/81929
+// { dg-do compile }
+// { dg-options "-std=c++14 -fsanitize=undefined" }
+
+struct S { S &operator<< (long); S foo (); S (); };
+
+void
+bar ()
+{
+ static_cast<S&>(S () << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0
+ << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0
+ << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0
+ << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0).foo ();
+}

View File

@ -1,94 +0,0 @@
2017-09-15 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
2017-09-12 Jakub Jelinek <jakub@redhat.com>
PR target/82112
* c-common.c (sync_resolve_size): Instead of c_dialect_cxx ()
assertion check that in the condition.
(get_atomic_generic_size): Likewise. Before testing if parameter
has pointer type, if it has array type, call for C++
default_conversion to perform array-to-pointer conversion.
* c-c++-common/pr82112.c: New test.
* gcc.dg/pr82112.c: New test.
--- gcc/c-family/c-common.c (revision 252002)
+++ gcc/c-family/c-common.c (revision 252003)
@@ -6478,10 +6478,9 @@ sync_resolve_size (tree function, vec<tr
}
argtype = type = TREE_TYPE ((*params)[0]);
- if (TREE_CODE (type) == ARRAY_TYPE)
+ if (TREE_CODE (type) == ARRAY_TYPE && c_dialect_cxx ())
{
/* Force array-to-pointer decay for C++. */
- gcc_assert (c_dialect_cxx());
(*params)[0] = default_conversion ((*params)[0]);
type = TREE_TYPE ((*params)[0]);
}
@@ -6646,10 +6645,9 @@ get_atomic_generic_size (location_t loc,
/* Get type of first parameter, and determine its size. */
type_0 = TREE_TYPE ((*params)[0]);
- if (TREE_CODE (type_0) == ARRAY_TYPE)
+ if (TREE_CODE (type_0) == ARRAY_TYPE && c_dialect_cxx ())
{
/* Force array-to-pointer decay for C++. */
- gcc_assert (c_dialect_cxx());
(*params)[0] = default_conversion ((*params)[0]);
type_0 = TREE_TYPE ((*params)[0]);
}
@@ -6688,6 +6686,12 @@ get_atomic_generic_size (location_t loc,
/* __atomic_compare_exchange has a bool in the 4th position, skip it. */
if (n_param == 6 && x == 3)
continue;
+ if (TREE_CODE (type) == ARRAY_TYPE && c_dialect_cxx ())
+ {
+ /* Force array-to-pointer decay for C++. */
+ (*params)[x] = default_conversion ((*params)[x]);
+ type = TREE_TYPE ((*params)[x]);
+ }
if (!POINTER_TYPE_P (type))
{
error_at (loc, "argument %d of %qE must be a pointer type", x + 1,
--- gcc/testsuite/gcc.dg/pr82112.c (nonexistent)
+++ gcc/testsuite/gcc.dg/pr82112.c (revision 252003)
@@ -0,0 +1,21 @@
+/* PR target/82112 */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu90" } */
+
+struct S { int a[10]; } bar (void);
+int b, c;
+
+void
+foo (void)
+{
+ __atomic_load (bar ().a, &b, __ATOMIC_ACQUIRE); /* { dg-error "argument 1 of .__atomic_load. must be a non-void pointer type" } */
+ __atomic_load (&b, bar ().a, __ATOMIC_ACQUIRE); /* { dg-error "argument 2 of .__atomic_load. must be a pointer type" } */
+ __atomic_store (bar ().a, &b, __ATOMIC_SEQ_CST); /* { dg-error "argument 1 of .__atomic_store. must be a non-void pointer type" } */
+ __atomic_store (&b, bar ().a, __ATOMIC_SEQ_CST); /* { dg-error "argument 2 of .__atomic_store. must be a pointer type" } */
+ __atomic_exchange (bar ().a, &b, &c, __ATOMIC_RELAXED); /* { dg-error "argument 1 of .__atomic_exchange. must be a non-void pointer type" } */
+ __atomic_exchange (&b, bar ().a, &c, __ATOMIC_RELAXED); /* { dg-error "argument 2 of .__atomic_exchange. must be a pointer type" } */
+ __atomic_exchange (&b, &c, bar ().a, __ATOMIC_RELAXED); /* { dg-error "argument 3 of .__atomic_exchange. must be a pointer type" } */
+ __atomic_compare_exchange (bar ().a, &b, &c, 1, __ATOMIC_RELAXED, __ATOMIC_RELAXED); /* { dg-error "argument 1 of .__atomic_compare_exchange. must be a non-void pointer type" } */
+ __atomic_compare_exchange (&b, bar ().a, &c, 1, __ATOMIC_RELAXED, __ATOMIC_RELAXED); /* { dg-error "argument 2 of .__atomic_compare_exchange. must be a pointer type" } */
+ __atomic_compare_exchange (&b, &c, bar ().a, 1, __ATOMIC_RELAXED, __ATOMIC_RELAXED); /* { dg-error "argument 3 of .__atomic_compare_exchange. must be a pointer type" } */
+}
--- gcc/testsuite/c-c++-common/pr82112.c (nonexistent)
+++ gcc/testsuite/c-c++-common/pr82112.c (revision 252003)
@@ -0,0 +1,13 @@
+/* PR target/82112 */
+/* { dg-do compile } */
+
+int c[10], d[10], e[10], f[10], g[10], h[10], i[10], j[10], k[10], l[10];
+
+void
+foo (void)
+{
+ __atomic_load (c, d, __ATOMIC_ACQUIRE);
+ __atomic_store (e, f, __ATOMIC_SEQ_CST);
+ __atomic_exchange (g, h, i, __ATOMIC_RELAXED);
+ __atomic_compare_exchange (j, k, l, 1, __ATOMIC_RELAXED, __ATOMIC_RELAXED);
+}

View File

@ -1,101 +0,0 @@
2017-09-15 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
2017-09-12 Jakub Jelinek <jakub@redhat.com>
PR target/82112
* config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin): For
ALTIVEC_BUILTIN_VEC_LD if arg1 has array type call default_conversion
on it early, rather than manual conversion late. For
ALTIVEC_BUILTIN_VEC_ST if arg2 has array type call default_conversion
instead of performing manual conversion.
* gcc.target/powerpc/pr82112.c: New test.
* g++.dg/ext/altivec-18.C: New test.
--- gcc/config/rs6000/rs6000-c.c (revision 252027)
+++ gcc/config/rs6000/rs6000-c.c (revision 252028)
@@ -6489,7 +6489,13 @@ altivec_resolve_overloaded_builtin (loca
/* Strip qualifiers like "const" from the pointer arg. */
tree arg1_type = TREE_TYPE (arg1);
- if (!POINTER_TYPE_P (arg1_type) && TREE_CODE (arg1_type) != ARRAY_TYPE)
+ if (TREE_CODE (arg1_type) == ARRAY_TYPE && c_dialect_cxx ())
+ {
+ /* Force array-to-pointer decay for C++. */
+ arg1 = default_conversion (arg1);
+ arg1_type = TREE_TYPE (arg1);
+ }
+ if (!POINTER_TYPE_P (arg1_type))
goto bad;
tree inner_type = TREE_TYPE (arg1_type);
@@ -6509,15 +6515,6 @@ altivec_resolve_overloaded_builtin (loca
if (!ptrofftype_p (TREE_TYPE (arg0)))
arg0 = build1 (NOP_EXPR, sizetype, arg0);
- tree arg1_type = TREE_TYPE (arg1);
- if (TREE_CODE (arg1_type) == ARRAY_TYPE)
- {
- arg1_type = TYPE_POINTER_TO (TREE_TYPE (arg1_type));
- tree const0 = build_int_cstu (sizetype, 0);
- tree arg1_elt0 = build_array_ref (loc, arg1, const0);
- arg1 = build1 (ADDR_EXPR, arg1_type, arg1_elt0);
- }
-
tree addr = fold_build2_loc (loc, POINTER_PLUS_EXPR, arg1_type,
arg1, arg0);
tree aligned = fold_build2_loc (loc, BIT_AND_EXPR, arg1_type, addr,
@@ -6572,12 +6569,11 @@ altivec_resolve_overloaded_builtin (loca
arg1 = build1 (NOP_EXPR, sizetype, arg1);
tree arg2_type = TREE_TYPE (arg2);
- if (TREE_CODE (arg2_type) == ARRAY_TYPE)
+ if (TREE_CODE (arg2_type) == ARRAY_TYPE && c_dialect_cxx ())
{
- arg2_type = TYPE_POINTER_TO (TREE_TYPE (arg2_type));
- tree const0 = build_int_cstu (sizetype, 0);
- tree arg2_elt0 = build_array_ref (loc, arg2, const0);
- arg2 = build1 (ADDR_EXPR, arg2_type, arg2_elt0);
+ /* Force array-to-pointer decay for C++. */
+ arg2 = default_conversion (arg2);
+ arg2_type = TREE_TYPE (arg2);
}
/* Find the built-in to make sure a compatible one exists; if not
--- gcc/testsuite/gcc.target/powerpc/pr82112.c (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/pr82112.c (revision 252028)
@@ -0,0 +1,16 @@
+/* PR target/82112 */
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_altivec_ok } */
+/* { dg-options "-maltivec -std=gnu90" } */
+
+#include <altivec.h>
+
+struct __attribute__((aligned (16))) S { unsigned char c[64]; } bar (void);
+vector unsigned char v;
+
+void
+foo (void)
+{
+ vec_ld (0, bar ().c); /* { dg-error "invalid parameter combination for AltiVec intrinsic" } */
+ vec_st (v, 0, bar ().c); /* { dg-error "invalid parameter combination for AltiVec intrinsic" } */
+}
--- gcc/testsuite/g++.dg/ext/altivec-18.C (nonexistent)
+++ gcc/testsuite/g++.dg/ext/altivec-18.C (revision 252028)
@@ -0,0 +1,14 @@
+// PR target/82112
+// { dg-do compile { target powerpc*-*-* } }
+// { dg-require-effective-target powerpc_altivec_ok }
+// { dg-options "-maltivec" }
+
+#include <altivec.h>
+
+__attribute__((aligned (16))) extern const unsigned char c[16];
+
+void
+foo (void)
+{
+ vec_ld (0, c);
+}

180
gcc7-pr84128.patch Normal file
View File

@ -0,0 +1,180 @@
PR target/84128
* config/i386/i386.c (release_scratch_register_on_entry): Add new
OFFSET and RELEASE_VIA_POP arguments. Use SP+OFFSET to restore
the scratch if RELEASE_VIA_POP is false.
(ix86_adjust_stack_and_probe_stack_clash): Un-constify SIZE.
If we have to save a temporary register, decrement SIZE appropriately.
Pass new arguments to release_scratch_register_on_entry.
(ix86_adjust_stack_and_probe): Likewise.
(ix86_emit_probe_stack_range): Pass new arguments to
release_scratch_register_on_entry.
PR target/84128
* gcc.target/i386/pr84128.c: New test.
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index fef34a1..3196ac4 100644
--- gcc/config/i386/i386.c
+++ gcc/config/i386/i386.c
@@ -12567,22 +12567,39 @@ get_scratch_register_on_entry (struct scratch_reg *sr)
}
}
-/* Release a scratch register obtained from the preceding function. */
+/* Release a scratch register obtained from the preceding function.
+
+ If RELEASE_VIA_POP is true, we just pop the register off the stack
+ to release it. This is what non-Linux systems use with -fstack-check.
+
+ Otherwise we use OFFSET to locate the saved register and the
+ allocated stack space becomes part of the local frame and is
+ deallocated by the epilogue. */
static void
-release_scratch_register_on_entry (struct scratch_reg *sr)
+release_scratch_register_on_entry (struct scratch_reg *sr, HOST_WIDE_INT offset,
+ bool release_via_pop)
{
if (sr->saved)
{
- struct machine_function *m = cfun->machine;
- rtx x, insn = emit_insn (gen_pop (sr->reg));
+ if (release_via_pop)
+ {
+ struct machine_function *m = cfun->machine;
+ rtx x, insn = emit_insn (gen_pop (sr->reg));
- /* The RTX_FRAME_RELATED_P mechanism doesn't know about pop. */
- RTX_FRAME_RELATED_P (insn) = 1;
- x = gen_rtx_PLUS (Pmode, stack_pointer_rtx, GEN_INT (UNITS_PER_WORD));
- x = gen_rtx_SET (stack_pointer_rtx, x);
- add_reg_note (insn, REG_FRAME_RELATED_EXPR, x);
- m->fs.sp_offset -= UNITS_PER_WORD;
+ /* The RX FRAME_RELATED_P mechanism doesn't know about pop. */
+ RTX_FRAME_RELATED_P (insn) = 1;
+ x = gen_rtx_PLUS (Pmode, stack_pointer_rtx, GEN_INT (UNITS_PER_WORD));
+ x = gen_rtx_SET (stack_pointer_rtx, x);
+ add_reg_note (insn, REG_FRAME_RELATED_EXPR, x);
+ m->fs.sp_offset -= UNITS_PER_WORD;
+ }
+ else
+ {
+ rtx x = gen_rtx_PLUS (Pmode, stack_pointer_rtx, GEN_INT (offset));
+ x = gen_rtx_SET (sr->reg, gen_rtx_MEM (word_mode, x));
+ emit_insn (x);
+ }
}
}
@@ -12597,7 +12614,7 @@ release_scratch_register_on_entry (struct scratch_reg *sr)
pushed on the stack. */
static void
-ix86_adjust_stack_and_probe_stack_clash (const HOST_WIDE_INT size,
+ix86_adjust_stack_and_probe_stack_clash (HOST_WIDE_INT size,
const bool int_registers_saved)
{
struct machine_function *m = cfun->machine;
@@ -12713,6 +12730,12 @@ ix86_adjust_stack_and_probe_stack_clash (const HOST_WIDE_INT size,
struct scratch_reg sr;
get_scratch_register_on_entry (&sr);
+ /* If we needed to save a register, then account for any space
+ that was pushed (we are not going to pop the register when
+ we do the restore). */
+ if (sr.saved)
+ size -= UNITS_PER_WORD;
+
/* Step 1: round SIZE down to a multiple of the interval. */
HOST_WIDE_INT rounded_size = size & -probe_interval;
@@ -12761,7 +12784,9 @@ ix86_adjust_stack_and_probe_stack_clash (const HOST_WIDE_INT size,
m->fs.cfa_reg == stack_pointer_rtx);
dump_stack_clash_frame_info (PROBE_LOOP, size != rounded_size);
- release_scratch_register_on_entry (&sr);
+ /* This does not deallocate the space reserved for the scratch
+ register. That will be deallocated in the epilogue. */
+ release_scratch_register_on_entry (&sr, size, false);
}
/* Make sure nothing is scheduled before we are done. */
@@ -12774,7 +12799,7 @@ ix86_adjust_stack_and_probe_stack_clash (const HOST_WIDE_INT size,
pushed on the stack. */
static void
-ix86_adjust_stack_and_probe (const HOST_WIDE_INT size,
+ix86_adjust_stack_and_probe (HOST_WIDE_INT size,
const bool int_registers_saved)
{
/* We skip the probe for the first interval + a small dope of 4 words and
@@ -12847,6 +12872,11 @@ ix86_adjust_stack_and_probe (const HOST_WIDE_INT size,
get_scratch_register_on_entry (&sr);
+ /* If we needed to save a register, then account for any space
+ that was pushed (we are not going to pop the register when
+ we do the restore). */
+ if (sr.saved)
+ size -= UNITS_PER_WORD;
/* Step 1: round SIZE to the previous multiple of the interval. */
@@ -12906,7 +12936,9 @@ ix86_adjust_stack_and_probe (const HOST_WIDE_INT size,
(get_probe_interval ()
+ dope))));
- release_scratch_register_on_entry (&sr);
+ /* This does not deallocate the space reserved for the scratch
+ register. That will be deallocated in the epilogue. */
+ release_scratch_register_on_entry (&sr, size, false);
}
/* Even if the stack pointer isn't the CFA register, we need to correctly
@@ -13055,7 +13087,7 @@ ix86_emit_probe_stack_range (HOST_WIDE_INT first, HOST_WIDE_INT size,
sr.reg),
rounded_size - size));
- release_scratch_register_on_entry (&sr);
+ release_scratch_register_on_entry (&sr, size, true);
}
/* Make sure nothing is scheduled before we are done. */
diff --git a/gcc/testsuite/gcc.target/i386/pr84128.c b/gcc/testsuite/gcc.target/i386/pr84128.c
new file mode 100644
index 0000000..a8323fd6
--- /dev/null
+++ gcc/testsuite/gcc.target/i386/pr84128.c
@@ -0,0 +1,30 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -march=i686 -mtune=generic -fstack-clash-protection" } */
+/* { dg-require-effective-target ia32 } */
+
+__attribute__ ((noinline, noclone, weak, regparm (3)))
+int
+f1 (long arg0, int (*pf) (long, void *))
+{
+ unsigned char buf[32768];
+ return pf (arg0, buf);
+}
+
+__attribute__ ((noinline, noclone, weak))
+int
+f2 (long arg0, void *ignored)
+{
+ if (arg0 != 17)
+ __builtin_abort ();
+ return 19;
+}
+
+int
+main (void)
+{
+ if (f1 (17, f2) != 19)
+ __builtin_abort ();
+ return 0;
+}
+
+

96
gcc7-pr84524.patch Normal file
View File

@ -0,0 +1,96 @@
2018-02-23 Jakub Jelinek <jakub@redhat.com>
PR target/84524
* config/i386/sse.md (*<code><mode>3): Replace <mask_prefix3> with
orig,vex.
(*<plusminus_insn><mode>3): Likewise. Remove <mask_operand3> uses.
* gcc.c-torture/execute/pr84524.c: New test.
* gcc.target/i386/avx512bw-pr84524.c: New test.
--- gcc/config/i386/sse.md.jj 2018-02-13 09:31:24.769607162 +0100
+++ gcc/config/i386/sse.md 2018-02-23 11:51:00.271477979 +0100
@@ -9938,11 +9938,11 @@ (define_insn "*<plusminus_insn><mode>3"
&& ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
"@
p<plusminus_mnemonic><ssemodesuffix>\t{%2, %0|%0, %2}
- vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
+ vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
[(set_attr "isa" "noavx,avx")
(set_attr "type" "sseiadd")
(set_attr "prefix_data16" "1,*")
- (set_attr "prefix" "<mask_prefix3>")
+ (set_attr "prefix" "orig,vex")
(set_attr "mode" "<sseinsnmode>")])
(define_insn "*<plusminus_insn><mode>3_mask"
@@ -11822,7 +11822,7 @@ (define_insn "*<code><mode>3"
(eq_attr "mode" "TI"))
(const_string "1")
(const_string "*")))
- (set_attr "prefix" "<mask_prefix3>")
+ (set_attr "prefix" "orig,vex")
(set (attr "mode")
(cond [(and (match_test "<MODE_SIZE> == 16")
(match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
--- gcc/testsuite/gcc.c-torture/execute/pr84524.c.jj 2018-02-23 11:54:51.913492631 +0100
+++ gcc/testsuite/gcc.c-torture/execute/pr84524.c 2018-02-23 11:59:55.467511836 +0100
@@ -0,0 +1,41 @@
+/* PR target/84524 */
+
+__attribute__((noipa)) void
+foo (unsigned short *x)
+{
+ unsigned short i, v;
+ unsigned char j;
+ for (i = 0; i < 256; i++)
+ {
+ v = i << 8;
+ for (j = 0; j < 8; j++)
+ if (v & 0x8000)
+ v = (v << 1) ^ 0x1021;
+ else
+ v = v << 1;
+ x[i] = v;
+ }
+}
+
+int
+main ()
+{
+ unsigned short a[256];
+
+ foo (a);
+ for (int i = 0; i < 256; i++)
+ {
+ unsigned short v = i << 8;
+ for (int j = 0; j < 8; j++)
+ {
+ asm volatile ("" : "+r" (v));
+ if (v & 0x8000)
+ v = (v << 1) ^ 0x1021;
+ else
+ v = v << 1;
+ }
+ if (a[i] != v)
+ __builtin_abort ();
+ }
+ return 0;
+}
--- gcc/testsuite/gcc.target/i386/avx512bw-pr84524.c.jj 2018-02-23 11:58:16.919505601 +0100
+++ gcc/testsuite/gcc.target/i386/avx512bw-pr84524.c 2018-02-23 11:58:57.377508169 +0100
@@ -0,0 +1,14 @@
+/* PR target/84524 */
+/* { dg-do run { target avx512bw } } */
+/* { dg-options "-O3 -mavx512bw" } */
+
+#include "avx512bw-check.h"
+
+#define main() do_main()
+#include "../../gcc.c-torture/execute/pr84524.c"
+
+static void
+avx512bw_test (void)
+{
+ do_main ();
+}

2477
gcc7-rh1512529-aarch64.patch Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,3 @@
SHA512 (gcc-7.2.1-20170915.tar.bz2) = 41cf64b6f9ea7b968d2d1a9b833231c32113311b63d23a4f830e8cbacbdeeb05bfd94ff1d0add62938146fc07c38018befb4efcf9e28b14df76ec6db5159ad1c
SHA512 (gcc-7.3.1-20180303.tar.bz2) = 3c65092ea40f401c7bb5c220079f367323b389668763a93962c321a98caa4d72487748c034903f5a6381d9edadc1bc848831f3bc5404db283a234cf2d7bb82f1
SHA512 (nvptx-newlib-aadc8eb0ec43b7cd0dd2dfb484bae63c8b05ef24.tar.bz2) = 38f97c9297ad108568352a4d28277455a3c01fd8b7864e798037e5006b6f757022e874bbf3f165775fe3b873781bc108137bbeb42dd5ed3c7d3e6747746fa918
SHA512 (nvptx-tools-c28050f60193b3b95a18866a96f03334e874e78f.tar.bz2) = 95b577a06a93bb044dbc8033e550cb36bcf2ab2687da030a7318cdc90e7467ed49665e247dcafb5ff4a7e92cdc264291d19728bd17fab902fb64b22491269330