------------------------ a4ap Arrays and Pointers ------------------------ 1 int main() | 2 { | 3 |main () 4 |{ 5 int a[256], c, d; | 6 int *b; | int * D.2048; 7 | int D.2049; 8 | int D.2050; 9 | int D.2051; 10 | int D.2052; 11 | const char * restrict D.2053; 12 | int a[256]; 13 | int c; 14 | int d; 15 | int * b; 16 b = a; | 17 | b = &a; 18 *(b + 3) = 20; | 19 | D.2048 = b + 12; 20 | *D.2048 = 20; 21 c = a[2]; | 22 | c = a[2]; 23 a[3] = a[4]; | 24 | D.2049 = a[4]; 25 | a[3] = D.2049; 26 printf("%d, %d, %d, %d", | 27 a[3], *b, c+1, d); | 28 | D.2050 = c + 1; 29 | D.2051 = *b; 30 | D.2052 = a[3]; 31 | D.2053 = (const char * restrict) 32 | &"%d, %d, %d, %d"[0]; 33 | printf (D.2053, D.2052, 34 | D.2051, D.2050, d); 35 } | 36 |} 1 "*(b + 3) = 20" is broken down into two steps: (a) The address of (b + 3) is calculated as (b + 12) because 3 elements in an array of integers occupy 12 bytes. (b) The calculated address, which is stored in a temporary pointer variable is now dereferenced to assign the constant 20. 2 The statement "c = a[2]" can be represented directly in GIMPLE as there is only one operator (array reference), one result and and two operands (a & 2). However, the statement "a[3] = a[4]" cannot be represented in one GIMPLE and hence is broken down using a temporary variable. 3 Parameters can only be passed as local variables. Hence the variable 'd' is passed as it is, but for the first three parameters (array reference, pointer dereference and arithmetic expression), a temporary variable is created to store the result of the expression which is then passed as the parameter.