Pass -fwrapv to stricter GCC 4.9

This commit is contained in:
Petr Písař 2014-04-10 16:04:28 +02:00
parent 6163468508
commit 654628d9a1
2 changed files with 69 additions and 1 deletions

View File

@ -0,0 +1,59 @@
From a8d0bb2102bc09bfdc7e661fb159d9257474f168 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Thu, 10 Apr 2014 16:16:31 +0200
Subject: [PATCH] Pass -fwrapv to stricter GCC 4.9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This is port to 5.18.2 of the two upstream patches:
commit 869747506fd0081f6c7eed149ec6f7adbcc4d5b1
Author: H.Merijn Brand <h.m.brand@xs4all.nl>
Date: Wed Apr 9 11:16:55 2014 +0200
gcc 4.9 by default does some optimizations that break perl (#121505)
Patch by Tony Cook
commit 00051dd553979bd2a1dee100c324b59ee76a49e7
Author: H.Merijn Brand <h.m.brand@xs4all.nl>
Date: Wed Apr 9 12:31:23 2014 +0200
-fwrapv is broken prior to gcc-4.3 (googled and patched by Zefram)
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
Configure | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/Configure b/Configure
index 37b49c8..47e7b8f 100755
--- a/Configure
+++ b/Configure
@@ -4520,6 +4520,22 @@ case "$gccversion" in
$rm -f try try.*
esac
+# gcc 4.9 by default does some optimizations that break perl.
+# see ticket 121505.
+#
+# The -fwrapv disables those optimizations (and probably others,) so
+# for gcc 4.9 (and later, since the optimizations probably won't go
+# away), add -fwrapv unless the user requests -fno-wrapv, which
+# disables -fwrapv, or if the user requests -fsanitize=undefined,
+# which turns the overflows -fwrapv ignores into runtime errors.
+case "$gccversion" in
+4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
+ case "$ccflags" in
+ *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
+ *) ccflags="$ccflags -fwrapv" ;;
+ esac
+esac
+
: What should the include directory be ?
echo " "
$echo $n "Hmm... $c"
--
1.9.0

View File

@ -30,7 +30,7 @@
Name: perl
Version: %{perl_version}
# release number must be even higher, because dual-lived modules will be broken otherwise
Release: 297%{?dist}
Release: 298%{?dist}
Epoch: %{perl_epoch}
Summary: Practical Extraction and Report Language
Group: Development/Languages
@ -122,6 +122,10 @@ Patch22: perl-5.18.1-Document-Math-BigInt-CalcEmu-requires-Math-BigInt.pa
# in upstream after 5.19.1
Patch23: perl-5.18.2-Make-t-comp-parser.t-get-the-correct-libraries.patch
# Pass -fwrapv to stricter GCC 4.9, bug #1082957, RT#121505,
# in upstream after 5.19.10
Patch24: perl-5.18.2-Pass-fwrapv-to-stricter-GCC-4.9.patch
# Link XS modules to libperl.so with EU::CBuilder on Linux, bug #960048
Patch200: perl-5.16.3-Link-XS-modules-to-libperl.so-with-EU-CBuilder-on-Li.patch
@ -1909,6 +1913,7 @@ tarball from perl.org.
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch200 -p1
%patch201 -p1
@ -1936,6 +1941,7 @@ perl -x patchlevel.h \
'Fedora Patch21: Fix using regular expressions containing multiple code blocks (RT#117917)' \
'Fedora Patch22: Document Math::BigInt::CalcEmu requires Math::BigInt (CPAN RT#85015)' \
'Fedora Patch23: Fix t/comp/parser.t not to load system modules (RT#121579)' \
'Fedora Patch24: Pass -fwrapv to stricter GCC 4.9 (RT#121505)' \
'Fedora Patch200: Link XS modules to libperl.so with EU::CBuilder on Linux' \
'Fedora Patch201: Link XS modules to libperl.so with EU::MM on Linux' \
%{nil}
@ -3610,6 +3616,9 @@ sed \
# Old changelog entries are preserved in CVS.
%changelog
* Thu Apr 10 2014 Petr Pisar <ppisar@redhat.com> - 4:5.18.2-298
- Pass -fwrapv to stricter GCC 4.9 (bug #1082957)
* Fri Apr 04 2014 Petr Pisar <ppisar@redhat.com> - 4:5.18.2-297
- Fix t/comp/parser.t not to load system modules (bug #1084399)