freebsd-ports/lang/scm/files/patch-bigrecy_32bit_upstream
Mikhail Teterin fce5ac2c97 Try to improve chances of successful build - including, but not
limited to disabling compiler-optimizations.

Proper fixing seems inherently impossible -- even with -O0 valgrind
flags hundreds of unitilized memory accesses during self-check.

Tested with gcc8 and the base cc (clang) -- remove the GCC-requirement.

Add some patches from Debian.

While here simplify the extract-target a little and remove the BROKEN*
lines to attempt building on other platforms again...

Bump port-revision.

PR:		 232936
2018-11-18 22:06:44 +00:00

96 lines
2.8 KiB
Text

Obtained from Debian
https://launchpad.net/ubuntu/+source/scm/5f2-2build1
Description: Support ARM64 ("aarch64") platform
Author: Jakub Bogusz
--- scl.c 2015/01/03 20:50:15 1.142
+++ scl.c 2016/08/10 02:33:05 1.143
@@ -166,33 +166,34 @@
/* try first with starved precision */
{
num = scm_ash(mant, MAKINUM(e2 - point));
- bigrecy(mant);
+ if (num != mant) bigrecy(mant);
quo = scm_round_quotient(num, VELTS(pows5)[(long) point]);
if (pmantexp2dbl(quo, point) != f) {
- bigrecy(quo); quo = num;
+ if (quo != num) { bigrecy(quo); quo = num; }
num = scm_ash(quo, MAKINUM(1L));
- bigrecy(quo);
+ if (num != quo) bigrecy(quo);
quo = scm_round_quotient(num, VELTS(pows5)[(long) --point]);
}
+ if (num != quo) bigrecy(num);
}
} else { /* e2 <= 0 */
/* try first with starved precision */
{
SCM den = scm_ash(MAKINUM(1L), MAKINUM(point - e2));
num = product(mant, VELTS(pows5)[- (long) point]);
- bigrecy(mant);
+ if (num != mant) { bigrecy(mant); if (mant != MAKINUM(1)) mant = INUM0; }
quo = scm_round_quotient(num, den);
if (pmantexp2dbl(quo, point) != f) {
- bigrecy(quo); quo = num;
+ if (quo != num) { bigrecy(quo); quo = num; }
point--;
num = product(quo, MAKINUM(10));
if (mant != MAKINUM(1)) bigrecy(quo);
quo = scm_round_quotient(num, den);
- }
+ if (quo != num) bigrecy(num);
+ } else if ((mant != MAKINUM(1)) && (quo != num)) bigrecy(num);
bigrecy(den);
}
}
- bigrecy(num);
a[ch++] = '.';
/* if (sizeof(UBIGLONG)>=sizeof(double)) /\* Is ulong larger than mantissa? *\/ */
/* ch += iulong2str(num2ulong(quo, (char *)ARG1, s_number2string), 10, &a[ch]); */
@@ -680,7 +681,7 @@
ans = ldexp(ans, bex + point);
}
if (num != quo) bigrecy(quo);
- if (bmant != MAKINUM(1L)) bigrecy(num);
+ if ((num != bmant) && (bmant != MAKINUM(1L))) bigrecy(num);
return ans;
} else {
int maxpow = LENGTH(pows5) - 1;
@@ -696,7 +697,7 @@
quo = scm_round_quotient(num, scm_ash(scl, MAKINUM(1L)));
}
if (-point > maxpow) bigrecy(scl);
- bigrecy(num);
+ if (num != quo) bigrecy(num);
ans = ldexp(int2dbl(quo), bex + point);
bigrecy(quo);
return ans;
@@ -2478,7 +2479,7 @@
tmp = acc;
acc = product(tmp, tz1);
#ifdef BIGDIG
- bigrecy(tmp);
+ if (acc != tmp) bigrecy(tmp);
#endif
break;
}
@@ -2486,7 +2487,7 @@
tmp = acc;
acc = product(tmp, tz1);
#ifdef BIGDIG
- bigrecy(tmp);
+ if (acc != tmp) bigrecy(tmp);
#endif
}
tmp = tz1;
@@ -2841,8 +2842,8 @@
bex += j * BITSPERDIG;
if (bex > 0) ans = ldexp(ans, bex);
}
+ if (quo != num) bigrecy(quo);
if (num != b) bigrecy(num);
- if (quo != b) bigrecy(quo);
if (tc16_bigneg==TYP16(b)) return -ans;
return ans;
}