Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

points-analysis may not handle getelementptr #2

Open
joseph-isaacs opened this issue Sep 12, 2019 · 0 comments
Open

points-analysis may not handle getelementptr #2

joseph-isaacs opened this issue Sep 12, 2019 · 0 comments

Comments

@joseph-isaacs
Copy link

I am running cclyzer over this (clang-5 compiled) c extract. [-g -Og -S -emit-llvm]

#include <stdlib.h>

#define N 100

struct X {
  int a[40];
  int **p;
};

struct X fX(struct X s) {
1  s.a[2] = 2;
2  int *af = malloc(sizeof (int));
3  *af = 4;
4  *(s.p) = af;
5  return s;
}

void fread(int);
void fU(int**);

void fU(int **ip) {
1  fread(**ip);
}

int main() {
1  struct X structX;
2  structX.a[1] = 2;
3  structX = fX(structX);
4  fU(structX.p);
}

I will attach the results and facts file, but the analysis fails to find that before line 1 in fU that ip -> heap_alloc:fX[...] (points_to), tracing this back I find that getelementptr instructions don't propagate any (ptr/var)_points_to information.

@joseph-isaacs joseph-isaacs changed the title points-analysis may handle getelementptr points-analysis may not handle getelementptr Sep 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant