Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/gcc.dg/attr-copy-8.c @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
1 /* PR c/89685 - ICE on attribute copy with a compound expression | |
2 { dg-do compile } | |
3 { dg-options "-Wall -Wno-unused-value -Wno-int-to-pointer-cast" } */ | |
4 | |
5 #define ATTR(...) __attribute__ ((__VA_ARGS__)) | |
6 | |
7 typedef struct ATTR (packed) A { ATTR (packed) unsigned bf: 1; } A; | |
8 | |
9 typedef struct B | |
10 { | |
11 struct A a; | |
12 struct A *pa; | |
13 } B; | |
14 | |
15 extern struct A a; | |
16 extern struct A *pa; | |
17 extern B b; | |
18 extern B ab[1]; | |
19 extern B *pb; | |
20 | |
21 typedef struct C | |
22 { | |
23 ATTR (copy ((struct A *)0)) short m_pa_0; | |
24 ATTR (copy ((struct A *)(1, 0))) int m_pa_1_0; | |
25 ATTR (copy ((struct A *)(0, 1))) long m_pa_0_1; | |
26 | |
27 ATTR (copy (*(struct A *)0)) short m_xpa_0; | |
28 ATTR (copy (*(struct A *)(1, 0))) int m_xpa_1_0; | |
29 ATTR (copy (*(struct A *)(0, 1))) long m_xpa_0_1; | |
30 | |
31 ATTR (copy (((struct A *)0)[0])) short m_arpa_0; | |
32 ATTR (copy (((struct A *)(1, 0))[0])) int m_arpa_1_0; | |
33 ATTR (copy (((struct A *)(0, 1))[0])) long m_arpa_0_1; | |
34 | |
35 /* Also exercise COMPONENT_REF, ARRAY_REF, and INDIRECT_REF. */ | |
36 ATTR (copy (a)) short m_ra; | |
37 ATTR (copy (b.a)) int m_rb_a; | |
38 ATTR (copy (b.pa)) long m_rb_pa; | |
39 | |
40 ATTR (copy (&a)) short m_ara; | |
41 ATTR (copy (&b.a)) int m_arb_a; | |
42 ATTR (copy (*b.pa)) long m_xb_pa; | |
43 ATTR (copy (b.pa[0])) long m_arb_pa; | |
44 | |
45 ATTR (copy (*pa)) short m_xpa; | |
46 ATTR (copy (pa[0])) short m_arpa; | |
47 | |
48 ATTR (copy (ab[0].a)) int m_arab_a; | |
49 ATTR (copy (ab[1].pa)) long m_arab_pa; | |
50 ATTR (copy (*ab[2].pa)) int m_xarab_pa; | |
51 ATTR (copy (ab[3].pa->bf)) unsigned int m_arab_pa_bf: 1; | |
52 | |
53 ATTR (copy (pb->a)) int m_pb_a; | |
54 ATTR (copy (pb->pa)) long m_pb_pa; | |
55 ATTR (copy (*pb->pa)) int m_xpb_pa; | |
56 ATTR (copy (pb->pa->bf)) unsigned int m_pb_pa_bf: 1; | |
57 | |
58 ATTR (aligned (4), copy ((struct A *)(0))) short m_a4_pa_0; | |
59 } C; | |
60 | |
61 | |
62 _Static_assert (__builtin_has_attribute (((C*)0)->m_pa_0, packed)); | |
63 _Static_assert (__builtin_has_attribute (((C*)0)->m_pa_1_0, packed)); | |
64 _Static_assert (__builtin_has_attribute (((C*)0)->m_pa_0_1, packed)); | |
65 | |
66 _Static_assert (__builtin_has_attribute (((C*)0)->m_xpa_0, packed)); | |
67 _Static_assert (__builtin_has_attribute (((C*)0)->m_xpa_1_0, packed)); | |
68 _Static_assert (__builtin_has_attribute (((C*)0)->m_xpa_0_1, packed)); | |
69 | |
70 _Static_assert (__builtin_has_attribute (((C*)0)->m_arpa_0, packed)); | |
71 _Static_assert (__builtin_has_attribute (((C*)0)->m_arpa_1_0, packed)); | |
72 _Static_assert (__builtin_has_attribute (((C*)0)->m_arpa_0_1, packed)); | |
73 | |
74 _Static_assert (__builtin_has_attribute (((C*)0)->m_ra, packed)); | |
75 _Static_assert (__builtin_has_attribute (((C*)0)->m_rb_a, packed)); | |
76 _Static_assert (__builtin_has_attribute (((C*)0)->m_rb_pa, packed)); | |
77 | |
78 _Static_assert (__builtin_has_attribute (((C*)0)->m_ara, packed)); | |
79 _Static_assert (__builtin_has_attribute (((C*)0)->m_arb_a, packed)); | |
80 _Static_assert (__builtin_has_attribute (((C*)0)->m_xb_pa, packed)); | |
81 _Static_assert (__builtin_has_attribute (((C*)0)->m_arb_pa, packed)); | |
82 | |
83 _Static_assert (__builtin_has_attribute (((C*)0)->m_xpa, packed)); | |
84 _Static_assert (__builtin_has_attribute (((C*)0)->m_arpa, packed)); | |
85 | |
86 _Static_assert (__builtin_has_attribute (((C*)0)->m_arab_a, packed)); | |
87 _Static_assert (__builtin_has_attribute (((C*)0)->m_arab_pa, packed)); | |
88 _Static_assert (__builtin_has_attribute (((C*)0)->m_xarab_pa, packed)); | |
89 _Static_assert (__builtin_has_attribute (((C*)0)->m_arab_pa_bf, packed)); | |
90 | |
91 _Static_assert (__builtin_has_attribute (((C*)0)->m_pb_a, packed)); | |
92 _Static_assert (__builtin_has_attribute (((C*)0)->m_pb_pa, packed)); | |
93 _Static_assert (__builtin_has_attribute (((C*)0)->m_xpb_pa, packed)); | |
94 _Static_assert (__builtin_has_attribute (((C*)0)->m_pb_pa_bf, packed)); | |
95 | |
96 _Static_assert (__builtin_has_attribute (((C*)0)->m_a4_pa_0, packed)); | |
97 _Static_assert (__builtin_has_attribute (((C*)0)->m_a4_pa_0, aligned)); | |
98 _Static_assert (__alignof__ (((C*)0)->m_a4_pa_0) == 4); |