perl/perl-5.18.2-Pass-fwrapv-to-stricter-GCC-4.9.patch
2014-04-10 16:20:14 +02:00

60 lines
1.8 KiB
Diff

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