tcsh: import an Arch patch (merging the two patches into a single one) for fixing gcc5 optimisation

This commit is contained in:
Michael Raskin 2016-06-23 11:01:21 +02:00
parent b300a8937e
commit b3bcb59bd5
2 changed files with 35 additions and 2 deletions

View File

@ -0,0 +1,28 @@
From: christos <christos>
Date: Thu, 28 May 2015 11:47:03 +0000
Subject: [PATCH] avoid gcc-5 optimization malloc + memset = calloc (Fridolin
Pokorny)
---
tc.alloc.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tc.alloc.c b/tc.alloc.c
index b9aec63..c1cb330 100644
--- a/tc.alloc.c
+++ b/tc.alloc.c
@@ -348,10 +348,13 @@ calloc(size_t i, size_t j)
{
#ifndef lint
char *cp;
+ volatile size_t k;
i *= j;
cp = xmalloc(i);
- memset(cp, 0, i);
+ /* Stop gcc 5.x from optimizing malloc+memset = calloc */
+ k = i;
+ memset(cp, 0, k);
return ((memalign_t) cp);
#else

View File

@ -6,10 +6,15 @@ stdenv.mkDerivation rec {
version = "6.19.00";
src = fetchurl {
urls = [ "ftp://ftp.funet.fi/pub/unix/shells/tcsh/${name}.tar.gz"
"http://ftp.funet.fi/pub/mirrors/ftp.astron.com/pub/tcsh/${name}.tar.gz" ];
urls = [
"http://ftp.funet.fi/pub/mirrors/ftp.astron.com/pub/tcsh/${name}.tar.gz"
"ftp://ftp.astron.com/pub/tcsh/${name}.tar.gz"
"ftp://ftp.funet.fi/pub/unix/shells/tcsh/${name}.tar.gz"
];
sha256 = "0jaw51382pqyb6d1kgfg8ir0wd3p5qr2bmg8svcmjhlyp3h73qhj";
};
patches = [ ./avoid-gcc5-wrong-optimisation.patch ];
buildInputs = [ ncurses ];