alias analysis and functions

Hi,

I am trying to use alias analysis (Anderson) and noticed that for pointers to functions
I don’t get the expected result: a pointer that clearly may point to a function is
reported as NoAlias.

I use -anders-aa -aa-eval -print-no-aliases -print-may-aliases -print-must-aliases

Here is a test case:

///////////////try_calls_aliases.c
#include <stdio.h>

typedef int (*PF)();

PF pf01=0;
PF pf2=0;

int pointed_to_function0() {
printf(“pointed_to_function0\n”);
return 1;
}

int pointed_to_function1() {
pf01 = pointed_to_function1;
printf(“pointed_to_function1\n”);
return 1;
}

void ptr_function_caller(PF pf) {
printf(“ptr_function_caller\n”);
pf();
PF lpf0 = pointed_to_function0;
PF lpf1 = pointed_to_function1;
}

int main(int argc, char* argv[]) {
ptr_function_caller(pointed_to_function0);
return 0;
}

Hi,

I am trying to use alias analysis (Anderson) and noticed that for pointers to functions
I don’t get the expected result: a pointer that clearly may point to a function is
reported as NoAlias.

Hi Dan,

Andersaa is extremely experimental at this point and has many known bugs.

-Chris