apply upstream fix for ppc64 infinite loop

This commit is contained in:
Tom Callaway 2020-06-02 14:50:27 -04:00
parent ac049188bd
commit 8a1584b8c4
2 changed files with 57 additions and 1 deletions

View File

@ -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 = <large> = 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 <Rinterface.h>
#include <Fileio.h>
#include <ctype.h> /* toupper */
+#include <float.h> // -> FLT_RADIX
#include <limits.h>
#include <string.h>
#include <stdlib.h> /* for realpath */

8
R.spec
View File

@ -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 <<EOF > %{name}-prov
@ -1243,6 +1246,9 @@ R CMD javareconf \
%{_libdir}/libRmath.a
%changelog
* Tue Jun 2 2020 Tom Callaway <spot@fedoraproject.org> - 4.0.0-2
- apply upstream fix for ppc64 infinite loop
* Fri May 8 2020 Tom Callaway <spot@fedoraproject.org> - 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.