Skip to content
Snippets Groups Projects
Commit 34a08189 authored by Tristan Le Gall's avatar Tristan Le Gall
Browse files

[alias] more examples

parent c18d3f33
No related branches found
No related tags found
No related merge requests found
Showing
with 317 additions and 41 deletions
......@@ -4,6 +4,6 @@ int main () {
int *a, b, *c;
a = &b;
*c = b;
c = &b;
return 0;
}
......@@ -5,9 +5,6 @@ int* my_malloc(int size) {
return res;
}
int main(void)
{
int *a, *b;
......
......@@ -10,10 +10,6 @@ void *f1(int *x, int* y)
return (void *) 0;
}
int main(void)
{
int *a, *b, *c, *d;
......
#include <stdio.h>
int * addr(int* x)
{
return x;
}
int main(void)
{
int *a, *b, c;
a = addr(&c);
b = &c;
c=4;
*a=5;
printf("*b=%d\n",*b);
return 0;
}
......@@ -8,7 +8,7 @@ Before statement a = & b; :
<list of may-alias>
<end of list>
Before statement *c = b; :
Before statement c = & b; :
<list of may-alias>
<end of list>
......
[kernel] Parsing conditional2.c (with preprocessing)
[alias] Parsing done
[alias] May-aliases at the end of function main:
<list of may-alias>
{ a; b } are aliased
<end of list>
[alias] Functions done
Before statement b = (void *)(& c); :
<list of may-alias>
<end of list>
Before statement c = (void *)(& d); :
<list of may-alias>
<end of list>
Before statement d = (void *)(& e); :
<list of may-alias>
<end of list>
Before statement if (a) a = b; else a = c; :
<list of may-alias>
<end of list>
Before statement a = b; :
<list of may-alias>
<end of list>
Before statement a = c; :
<list of may-alias>
<end of list>
Before statement __retres = 0; :
<list of may-alias>
{ a; b } are aliased
<end of list>
Before statement return __retres; :
<list of may-alias>
{ a; b } are aliased
<end of list>
[alias] Analysis complete
[kernel] Parsing function2.c (with preprocessing)
[kernel:typing:implicit-function-declaration] function2.c:4: Warning:
Calling undeclared function malloc. Old style K&R code?
[alias] Parsing done
[alias] May-aliases at the end of function main:
<list of may-alias>
<end of list>
[alias] Functions done
Before statement tmp = malloc(size); :
<list of may-alias>
<end of list>
Before statement tmp = malloc(size); :
<list of may-alias>
<end of list>
Before statement int *res = (int *)tmp; :
<list of may-alias>
<end of list>
Before statement return res; :
<list of may-alias>
{ res; tmp } are aliased
<end of list>
Before statement a = my_malloc(2); :
<list of may-alias>
<end of list>
Before statement b = my_malloc(3); :
<list of may-alias>
<end of list>
Before statement __retres = 0; :
<list of may-alias>
<end of list>
Before statement return __retres; :
<list of may-alias>
<end of list>
[alias] Analysis complete
[kernel] Parsing function3.c (with preprocessing)
[alias] Parsing done
[alias] May-aliases at the end of function main:
<list of may-alias>
{ a; b } are aliased
{ c; d } are aliased
<end of list>
[alias] Functions done
Before statement int *tmp = x; :
<list of may-alias>
<end of list>
Before statement while (1) {
x = y;
y = tmp;
break;
} :
<list of may-alias>
{ x; tmp } are aliased
<end of list>
Before statement x = y;
y = tmp;
break; :
<list of may-alias>
{ x; tmp } are aliased
<end of list>
Before statement x = y; :
<list of may-alias>
{ x; y; tmp } are aliased
<end of list>
Before statement x = y; :
<list of may-alias>
{ x; tmp } are aliased
<end of list>
Before statement y = tmp; :
<list of may-alias>
{ x; y; tmp } are aliased
<end of list>
Before statement y = tmp; :
<list of may-alias>
{ x; y; tmp } are aliased
<end of list>
Before statement break; :
<list of may-alias>
{ x; y; tmp } are aliased
<end of list>
Before statement break; :
<list of may-alias>
{ x; y; tmp } are aliased
<end of list>
Before statement __retres = (void *)0; :
<list of may-alias>
{ x; y; tmp } are aliased
<end of list>
Before statement f1(a,b); :
<list of may-alias>
<end of list>
Before statement f1(c,d); :
<list of may-alias>
{ a; b } are aliased
<end of list>
Before statement __retres = 0; :
<list of may-alias>
{ a; b } are aliased
{ c; d } are aliased
<end of list>
Before statement return __retres; :
<list of may-alias>
{ x; y; tmp } are aliased
<end of list>
Before statement return __retres; :
<list of may-alias>
{ a; b } are aliased
{ c; d } are aliased
<end of list>
[alias] Analysis complete
[kernel] Parsing while_for1.c (with preprocessing)
[kernel:typing:implicit-function-declaration] while_for1.c:7: Warning:
Calling undeclared function malloc. Old style K&R code?
[alias] Parsing done
[alias] Skipping assignment odata[idx] = 0.5 * idata[idx] (not implemented)
[alias] Skipping assignment odata[idx] = 0.5 * idata[idx] (not implemented)
[alias] Skipping assignment odata[idx] = 0.5 * idata[idx] (not implemented)
[alias] Warning: DEBUG return stmt of main not in table
[alias] Warning: Analysis is continuing but will not be sound
[alias] May-aliases at the end of function main:
<list of may-alias>
<end of list>
[alias] Functions done
Before statement while (1) {
idx = 0;
while (idx < 10) {
odata[idx] = 0.5 * idata[idx];
idx ++;
}
} :
Before statement int *s = (int *)0; :
<list of may-alias>
<end of list>
Before statement idx = 0;
while (idx < 10) {
odata[idx] = 0.5 * idata[idx];
idx ++;
Before statement {
int idx = 0;
while (idx < 10) {
{
int tmp;
tmp = malloc(idx);
s = (int *)tmp;
}
idx ++;
}
} :
<list of may-alias>
<end of list>
Before statement idx = 0; :
Before statement int idx = 0; :
<list of may-alias>
<end of list>
Before statement idx = 0; :
Before statement int idx = 0; :
<list of may-alias>
<end of list>
Before statement while (idx < 10) {
odata[idx] = 0.5 * idata[idx];
{
int tmp;
tmp = malloc(idx);
s = (int *)tmp;
}
idx ++;
} :
<list of may-alias>
<end of list>
Before statement while (idx < 10) {
odata[idx] = 0.5 * idata[idx];
{
int tmp;
tmp = malloc(idx);
s = (int *)tmp;
}
idx ++;
} :
<list of may-alias>
......@@ -57,20 +62,43 @@ Before statement break; :
<list of may-alias>
<end of list>
Before statement odata[idx] = 0.5 * idata[idx]; :
Before statement {
int tmp;
tmp = malloc(idx);
s = (int *)tmp;
} :
<list of may-alias>
<end of list>
Before statement odata[idx] = 0.5 * idata[idx]; :
Before statement tmp = malloc(idx);
s = (int *)tmp; :
<list of may-alias>
<end of list>
Before statement odata[idx] = 0.5 * idata[idx]; :
Before statement tmp = malloc(idx);
s = (int *)tmp; :
<list of may-alias>
<end of list>
Before statement tmp = malloc(idx); :
<list of may-alias>
<end of list>
Before statement s = (int *)tmp; :
<list of may-alias>
<end of list>
Before statement idx ++; :
<list of may-alias>
{ s; tmp } are aliased
<end of list>
Before statement __retres = 0; :
<list of may-alias>
<end of list>
Before statement return __retres; :
<list of may-alias>
<end of list>
[alias] Analysis complete
[kernel] Parsing while_for2.c (with preprocessing)
[alias] Parsing done
[alias] May-aliases at the end of function main:
<list of may-alias>
{ a; b } are aliased
<end of list>
[alias] Functions done
Before statement while (1) {
a = b;
break;
} :
<list of may-alias>
<end of list>
Before statement a = b;
break; :
<list of may-alias>
<end of list>
Before statement a = b; :
<list of may-alias>
{ a; b } are aliased
<end of list>
Before statement a = b; :
<list of may-alias>
<end of list>
Before statement break; :
<list of may-alias>
{ a; b } are aliased
<end of list>
Before statement break; :
<list of may-alias>
{ a; b } are aliased
<end of list>
Before statement while (1) {
break;
a = c;
break;
} :
<list of may-alias>
{ a; b } are aliased
<end of list>
Before statement break;
a = c;
break; :
<list of may-alias>
{ a; b } are aliased
<end of list>
Before statement break; :
<list of may-alias>
{ a; b } are aliased
<end of list>
Before statement __retres = 0; :
<list of may-alias>
{ a; b } are aliased
<end of list>
Before statement return __retres; :
<list of may-alias>
{ a; b } are aliased
<end of list>
[alias] Analysis complete
......@@ -2,15 +2,9 @@
int main ()
{
double idata [10];
double odata [10];
int idx;
while (1) {
for (idx = 0; idx < 10; idx++) {
odata[idx] = 0.5*idata[idx];
}
int* s = 0;
for (int idx = 0; idx < 10; idx++) {
s = malloc(idx);
}
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment