libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / pr97236.c
blob9d3dc20d953d06732229f693f03ed0c465230c26
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;
9 typedef struct {
10 plane_t p[5];
11 } picture_t;
13 #define N 4
15 void __attribute__((noipa))
16 picture_Clone(picture_t *picture, picture_t *res)
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;
25 int
26 main()
28 picture_t aaa, bbb;
29 uint8_t pixels[10] = {1, 1, 1, 1, 1, 1, 1, 1};
31 for (unsigned i = 0; i < N; i++)
32 aaa.p[i].p_pixels = pixels;
34 picture_Clone (&aaa, &bbb);
36 uint8_t c = 0;
37 for (unsigned i = 0; i < N; i++)
38 c += bbb.p[i].p_pixels[0];
40 if (c != N)
41 __builtin_abort ();
42 return 0;