xref: /third_party/ltp/tools/sparse/sparse-src/validation/packed-bitfield5.c (revision f08c3bdf)
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/ltp/tools/sparse/sparse-src/validation/
1f08c3bdfSopenharmony_ci#define __packed __attribute__((packed))
2f08c3bdfSopenharmony_ci
3f08c3bdfSopenharmony_citypedef __UINT32_TYPE__ u32;
4f08c3bdfSopenharmony_ci
5f08c3bdfSopenharmony_cistruct s {
6f08c3bdfSopenharmony_ci	u32	a:5;
7f08c3bdfSopenharmony_ci	u32	f:30;
8f08c3bdfSopenharmony_ci	u32	z:5;
9f08c3bdfSopenharmony_ci} __packed;
10f08c3bdfSopenharmony_ci_Static_assert(sizeof(struct s) == 5);
11f08c3bdfSopenharmony_ci
12f08c3bdfSopenharmony_cistatic int ld(struct s *s)
13f08c3bdfSopenharmony_ci{
14f08c3bdfSopenharmony_ci	return s->f;
15f08c3bdfSopenharmony_ci}
16f08c3bdfSopenharmony_ci
17f08c3bdfSopenharmony_ci/*
18f08c3bdfSopenharmony_ci * check-name: packed-bitfield5
19f08c3bdfSopenharmony_ci * check-description: is check_access() OK with 'overlapping' packed bitfields?
20f08c3bdfSopenharmony_ci */
21

Indexes created Thu Nov 07 10:32:03 CST 2024