From b3bcb59bd5fddc3c0f74bbe120de561bbea29878 Mon Sep 17 00:00:00 2001 From: Michael Raskin <7c6f434c@mail.ru> Date: Thu, 23 Jun 2016 11:01:21 +0200 Subject: tcsh: import an Arch patch (merging the two patches into a single one) for fixing gcc5 optimisation --- .../tcsh/avoid-gcc5-wrong-optimisation.patch | 28 ++++++++++++++++++++++ pkgs/shells/tcsh/default.nix | 9 +++++-- 2 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 pkgs/shells/tcsh/avoid-gcc5-wrong-optimisation.patch diff --git a/pkgs/shells/tcsh/avoid-gcc5-wrong-optimisation.patch b/pkgs/shells/tcsh/avoid-gcc5-wrong-optimisation.patch new file mode 100644 index 00000000000..b35d29680af --- /dev/null +++ b/pkgs/shells/tcsh/avoid-gcc5-wrong-optimisation.patch @@ -0,0 +1,28 @@ +From: 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 diff --git a/pkgs/shells/tcsh/default.nix b/pkgs/shells/tcsh/default.nix index 52e6299c60c..419acd8d61d 100644 --- a/pkgs/shells/tcsh/default.nix +++ b/pkgs/shells/tcsh/default.nix @@ -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 ]; -- cgit 1.4.1