E.g., in CortexSuite PCA, this is generated:
void vector_out0(float *decomp_0, float *v) {
decomp_0 = v - 1;
}
void vector(int n, float **rtr_val) {
float *v;
float *decomp_0;
v = (float *) malloc((unsigned int) n * sizeof(float));
if(!v) {
erhand("Allocation failure in vector().");
}
vector_out0(decomp_0, v);
*rtr_val = decomp_0;
return;
}
whereas the correct version should be:
void vector_out0(float **decomp_0, float *v) {
*decomp_0 = v - 1;
}
void vector(int n, float **rtr_val) {
float *v;
float *decomp_0;
v = (float *) malloc((unsigned int) n * sizeof(float));
if(!v) {
erhand("Allocation failure in vector().");
}
vector_out0(&decomp_0, v);
*rtr_val = decomp_0;
return;
}
E.g., in CortexSuite PCA, this is generated:
whereas the correct version should be: