1 typedef unsigned char __uint8_t;
2 typedef __uint8_t uint8_t;
3 typedef struct plane_t {
4   uint8_t *p_pixels;
5   int i_lines;
6   int i_pitch;
7 } plane_t;
8 
9 typedef struct {
10   plane_t p[5];
11 } picture_t;
12 
13 #define N 4
14 
15 void __attribute__((noipa))
picture_Clone(picture_t * picture,picture_t * res)16 picture_Clone(picture_t *picture, picture_t *res)
17 {
18   for (int i = 0; i < N; i++) {
19     res->p[i].p_pixels = picture->p[i].p_pixels;
20     res->p[i].i_lines = picture->p[i].i_lines;
21     res->p[i].i_pitch = picture->p[i].i_pitch;
22   }
23 }
24 
25 int
main()26 main()
27 {
28   picture_t aaa, bbb;
29   uint8_t pixels[10] = {1, 1, 1, 1, 1, 1, 1, 1};
30 
31   for (unsigned i = 0; i < N; i++)
32     aaa.p[i].p_pixels = pixels;
33 
34   picture_Clone (&aaa, &bbb);
35 
36   uint8_t c = 0;
37   for (unsigned i = 0; i < N; i++)
38     c += bbb.p[i].p_pixels[0];
39 
40   if (c != N)
41     __builtin_abort ();
42   return 0;
43 }
44