[Prev][Next][Index]

bug



Here is problem with printf:

#include "pcxx.h"

class M {
  float rho[10][20];
};

#include "kernel.h"

Collection B {
 B();
 MethodOfElement:
 virtual float rho[10][20];
 void display();
};

B::B() {};

void B::display() {
printf("%f \n", rho[2][3]);
}

ProcessorMain() {
Processors P;
Distribution D(32, &P, BLOCK);
Align A(32, "[ALIGN(G[i],T[i])]");
B<M> C(&D, &A);
}


The compiler generates:
                                 
int  pcxx_printf15(char *pCar_0, float *pCar_1){  
      if ((pcxx_NodeNumber() == 0) || pcxx_inpar) 
      {
         printf(pCar_0, pCar_1);
       }
       return 1;
 }

void  M:: display(){
      pcxx_printf15("%f \n", rho[2][3]);
}

The problem is that
int  pcxx_printf15(char *pCar_0, float *pCar_1){  
                                       ^^^
should be 
int  pcxx_printf15(char *pCar_0, float pCar_1){  

However, if I add (float) in the pc++ code

printf("%f \n", (float)rho[2][3]);
                ^^^^^^
the problem goes away.

Shelby