Files
macports-ports/lang/ruby/files/patch-numeric.c.diff
Wataru Kimura 9a56545756 lang/ruby: allow build with clang (Xcode 4.2 or later).
passed `make test-all' on these environment.
    - Mac OS X 10.8GM, Xcode 4.4GM
    - Mac OS X 10.7.4, Xcode 4.3.3
    - Mac OS X 10.7.4, Xcode 4.2.1
    - Mac OS X 10.6.8, Xcode 3.2.6 (use gcc)

git-svn-id: https://svn.macports.org/repository/macports/trunk/dports@95753 d073be05-634f-4543-b044-5fe20cf6d1d6
2012-07-21 09:40:29 +00:00

33 lines
836 B
Diff

--- numeric.c.orig 2011-12-10 21:17:27.000000000 +0900
+++ numeric.c 2012-07-21 15:40:51.000000000 +0900
@@ -2161,7 +2161,7 @@
VALUE x, y;
{
if (FIXNUM_P(y)) {
-#ifdef __HP_cc
+#if defined(__HP_cc) || defined(__clang__)
/* avoids an optimization bug of HP aC++/ANSI C B3910B A.06.05 [Jul 25 2005] */
volatile
#endif
@@ -2319,9 +2319,9 @@
y &= ~1;
do {
while (y % 2 == 0) {
- long x2 = x * x;
+ volatile long x2 = x * x;
if (x2/x != x || !POSFIXABLE(x2)) {
- VALUE v;
+ volatile VALUE v;
bignum:
v = rb_big_pow(rb_int2big(x), LONG2NUM(y));
if (z != 1) v = rb_big_mul(rb_int2big(neg ? -z : z), v);
@@ -2331,7 +2331,7 @@
y >>= 1;
}
{
- long xz = x * z;
+ volatile long xz = x * z;
if (!POSFIXABLE(xz) || xz / x != z) {
goto bignum;
}