1 /* { dg-do run } */ 2 3 extern void abort (void); 4 5 #define LEN 4 6 unpack(int array[LEN])7static inline void unpack(int array[LEN]) 8 { 9 int ii, val; 10 val = 1; 11 for (ii = 0; ii < LEN; ii++) { 12 array[ii] = val % 2; 13 val = val / 2; 14 } 15 } 16 pack(int array[LEN])17static inline int pack(int array[LEN]) 18 { 19 int ans, ii; 20 ans = 0; 21 for (ii = LEN-1; ii >= 0; ii--) { 22 ans = 2 * ans + array[ii]; 23 } 24 return ans; 25 } 26 27 int __attribute__((noinline)) foo()28foo() 29 { 30 int temp, ans; 31 int array[LEN]; 32 unpack(array); 33 temp = array[0]; 34 array[0] = array[2]; 35 array[2] = temp; 36 ans = pack(array); 37 return ans; 38 } 39 main(void)40int main(void) 41 { 42 int val; 43 val = foo(); 44 if (val != 4) 45 abort (); 46 return 0; 47 } 48