• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #define bos(O, T)	__builtin_object_size(O, T)
2 
3 struct s {
4 	char arr[8];
5 	__INT32_TYPE__ i;
6 	__INT32_TYPE__ padding;
7 };
8 
9 static struct s s;
10 static char *p = &s.arr[1];
11 static int  *q = &s.i;
12 
obj_int0(void)13 int obj_int0(void) { return bos(&s.i, 0) == 8; }
obj_arr0(void)14 int obj_arr0(void) { return bos(&s.arr[1], 0) == 15; }
15 
ptr_int(struct s * p)16 int ptr_int(struct s *p) { return bos(&p->i, 0) == -1; }
ptr_arr(struct s * p)17 int ptr_arr(struct s *p) { return bos(&p->arr[1], 0) == -1; }
18 
19 /*
20  * check-name: builtin-objsize0
21  * check-command: test-linearize -Wno-decl $file
22  *
23  * check-output-ignore
24  * check-output-returns: 1
25  */
26