------------------------ a4ap Arrays and Pointers ------------------------ In this program we observe how GCC treats arrays, pointers and how they resemble each other. It is useful to understand that arrays are some kind of pointer constants. Compile the following program (file a4ap.c) and observe the compiler output GIMPLEs to answer the questions. Source file : a4ap.c Compilation : gcc -c -fdump-tree-gimple a4ap.c View result : vi -O a4ap.c a4ap.c.004t.gimple Clear dumps : rm -f a4ap.c.* a4ap.o Program ------- #include int main() { int a[256], c, d; int *b; b = a; *(b + 3) = 20; c = a[2]; a[3] = a[4]; printf("%d, %d, %d, %d", a[3], *b, c+1, d); } Questions --------- 1 How does the line "*(b + 3) = 20" get translated? Why is the 3 converted to 12 in GIMPLE? 2 Does the statement "c = a[2]" get broken down in GIMPLE? What about "a[3] = a[4]"? 3 How are parameters passed to the function printf()?