NO

Author Topic: ERROR "fatal error: Internal error: find_cheapest_spill_range()"  (Read 2102 times)

mkey

  • Guest
Hi guys, my first post here, wanted to put this up quick here so you can examine what's going on.

I'm trying to compile the cyassl library from here http://www.yassl.com/yaSSL/Download.html. I've been editing the project structure a bit. I'll attach those slightly modified files below.

I'm using the latest, RC4 version (32 bit) on Windows 7 64 bit.

When compiling I get the error "fatal error: Internal error: find_cheapest_spill_range()" and the status log points to this function from the "integer.c" file

Code: [Select]
/* setups the montgomery reduction stuff */
int mp_montgomery_setup (mp_int * n, mp_digit * rho)
{
  mp_digit x, b;

/* fast inversion mod 2**k
 *
 * Based on the fact that
 *
 * XA = 1 (mod 2**n)  =>  (X(2-XA)) A = 1 (mod 2**2n)
 *                    =>  2*X*A - X*X*A*A = 1
 *                    =>  2*(1) - (1)     = 1
 */
  b = n->dp[0];

  if ((b & 1) == 0) {
    return MP_VAL;
  }

  x = (((b + 2) & 4) << 1) + b; /* here x*a==1 mod 2**4 */
  x *= 2 - b * x;               /* here x*a==1 mod 2**8 */
#if !defined(MP_8BIT)
  x *= 2 - b * x;               /* here x*a==1 mod 2**16 */
#endif
#if defined(MP_64BIT) || !(defined(MP_8BIT) || defined(MP_16BIT))
  x *= 2 - b * x;               /* here x*a==1 mod 2**32 */
#endif
#ifdef MP_64BIT
  x *= 2 - b * x;               /* here x*a==1 mod 2**64 */
#endif

  /* rho = -1/m mod b */
  /* TAO, switched mp_word casts to mp_digit to shut up compiler */
  *rho = (((mp_digit)1 << ((mp_digit) DIGIT_BIT)) - x) & MP_MASK;

  return MP_OKAY;
}

If I remove this bit of code

Code: [Select]
#if defined(MP_64BIT) || !(defined(MP_8BIT) || defined(MP_16BIT))
  x *= 2 - b * x;               /* here x*a==1 mod 2**32 */
#endif

it compiles OK. What I gather, if you have three of these in a row

Code: [Select]
x *= 2 - b * x;
In the attachment I stripped down the bare minimum files you need to replicate this error. Currently the project is in the compilable state, if you uncomment the line you should have the same conditions I had while getting this error.

I hope this was specific enough.