From 8a1584b8c4b485561f2750e210f85275ae0393f7 Mon Sep 17 00:00:00 2001 From: Tom Callaway Date: Tue, 2 Jun 2020 14:50:27 -0400 Subject: [PATCH] apply upstream fix for ppc64 infinite loop --- R-4.0.0-ppc64-infinite-loop-fix.patch | 50 +++++++++++++++++++++++++++ R.spec | 8 ++++- 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 R-4.0.0-ppc64-infinite-loop-fix.patch diff --git a/R-4.0.0-ppc64-infinite-loop-fix.patch b/R-4.0.0-ppc64-infinite-loop-fix.patch new file mode 100644 index 0000000..3fd9bb1 --- /dev/null +++ b/R-4.0.0-ppc64-infinite-loop-fix.patch @@ -0,0 +1,50 @@ +diff -up R-4.0.0/src/main/machar.c.ppc64 R-4.0.0/src/main/machar.c +--- R-4.0.0/src/main/machar.c.ppc64 2020-06-02 14:42:18.741222048 -0400 ++++ R-4.0.0/src/main/machar.c 2020-06-02 14:44:26.523106368 -0400 +@@ -98,21 +98,22 @@ MACH_NAME(int *ibeta, int *it, int *irnd + { + volatile DTYPE a, b, beta, betain, betah, one, + t, temp, tempa, temp1, two, y, z, zero; +- int i, itemp, iz, j, k, mx, nxres; ++ int i, iz, j, k, mx, nxres; + + one = 1; + two = one+one; + zero = one-one; + + /* determine ibeta, beta ala malcolm. */ +- +- a = one; ++ a = one; // a = = 9.0072e+15 for 'double' is used later + do { + a = a + a; + temp = a + one; + temp1 = temp - a; + } + while(temp1 - one == zero); ++#ifdef _no_longer___did_overflow_ // on IBM PowerPPC ('Power 8') ++ int itemp; + b = one; + do { + b = b + b; +@@ -121,6 +122,9 @@ MACH_NAME(int *ibeta, int *it, int *irnd + } + while (itemp == 0); + *ibeta = itemp; ++#else ++ *ibeta = (int) FLT_RADIX; ++#endif + beta = *ibeta; + + /* determine it, irnd */ +diff -up R-4.0.0/src/main/platform.c.ppc64 R-4.0.0/src/main/platform.c +--- R-4.0.0/src/main/platform.c.ppc64 2020-06-02 14:44:40.940754817 -0400 ++++ R-4.0.0/src/main/platform.c 2020-06-02 14:45:08.940072121 -0400 +@@ -43,6 +43,7 @@ + #include + #include + #include /* toupper */ ++#include // -> FLT_RADIX + #include + #include + #include /* for realpath */ diff --git a/R.spec b/R.spec index 32f2e08..60ac1a7 100644 --- a/R.spec +++ b/R.spec @@ -152,7 +152,7 @@ Name: R Version: %{major_version}.%{minor_version}.%{patch_version} -Release: 1%{?dist} +Release: 2%{?dist} Summary: A language for data analysis and graphics URL: http://www.r-project.org Source0: https://cran.r-project.org/src/base/R-4/R-%{version}.tar.gz @@ -200,6 +200,8 @@ BuildRequires: stunnel %endif # see https://bugzilla.redhat.com/show_bug.cgi?id=1324145 Patch1: R-3.3.0-fix-java_path-in-javareconf.patch +# https://github.com/wch/r-source/commit/6857d53313bf7a5afea4e3f0142d69a069b701d0 +Patch2: R-4.0.0-ppc64-infinite-loop-fix.patch License: GPLv2+ BuildRequires: gcc-gfortran BuildRequires: gcc-c++, tex(latex), texinfo-tex @@ -517,6 +519,7 @@ from the R project. This package provides the static libRmath library. %setup -q -n %{name}-%{version} %endif %patch1 -p1 -b .fixpath +%patch2 -p1 -b .ppc64 # Filter false positive provides. cat < %{name}-prov @@ -1243,6 +1246,9 @@ R CMD javareconf \ %{_libdir}/libRmath.a %changelog +* Tue Jun 2 2020 Tom Callaway - 4.0.0-2 +- apply upstream fix for ppc64 infinite loop + * Fri May 8 2020 Tom Callaway - 4.0.0-1 - update to 4.0.0 NOTE: This major release update requires all installed R modules to be rebuilt in order to work.