GNU MP - PPC 440 build observation

morten simonsen ms at
Sat Nov 26 11:59:51 CET 2011

I have build GNU mp 5.0.2, cross-compiling for PPC on an Intel machine, with 
the following command:

  sudo ./configure CC="/opt/eldk41/usr/bin/ppc_4xx-gcc" --host=none
  make check

The following program (pseudo-excerpt as much of it relates to a pool of 
initialized mpf_t's - used as local variables in functions):

#include <gmp.h>

void function(const double *x, const double *y) {
  mpf_t *kw = (mpf_t*) malloc(2*sizeof(mpf_t));
  mpf_t *a  = &(kw[0]);
  mpf_t *b  = &(kw[1]);
  int   i;


  for(i=0;i<100;i++) {

    // different stuff


  for(i=0;i<100;i++) {

    // different stuff



main() {
  double x = 1.;
  double y = 0.21;

I observe that the first mpf_set_d-assignments to *a does not give *a the value 
of *x, but the the mpf_set_d-assignments in the second for loop does indeed 
give *a the values of *y. *a is used for further calculations in both for 
loops, hence I do not think that it is compiler optimization.

I use the same code on a intel host environment where it runss as expected - 
might this be an crosscomnpiling issue?

I do not have much experience (yet) with the GNU MP, but it has been very 
useful on my host - now I just wish to run it on my embedded PPC target.

Anyone having similar experience - and solutions?

Thanks & BR Morten

P.S. tuneup crashes on the target (regretfully I can not build tune on my host 
(linker can not find

More information about the gmp-discuss mailing list