Skip to content

Outliner does not outline pointer arithmetic expressions correctly #8

Description

@tiagolascasas

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;
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions