Debian Codegraph @

gcc/testsuite/c-c++-common/analyzer/first-field-1.c

raw
1 #include "../../gcc.dg/analyzer/analyzer-decls.h"
2
3 typedef struct base_obj
4 {
5 int m_first;
6 int m_second;
7 } base_obj;
8
9 typedef struct sub_obj
10 {
11 base_obj base;
12 } sub_obj;
13
14 void test (sub_obj *sub)
15 {
16 sub->base.m_first = 1;
17 sub->base.m_second = 2;
18 __analyzer_eval (sub->base.m_first == 1); /* { dg-warning "TRUE" } */
19 __analyzer_eval (sub->base.m_second == 2); /* { dg-warning "TRUE" } */
20
21 base_obj *base = (struct base_obj *)sub;
22 __analyzer_eval (base->m_first == 1); /* { dg-warning "TRUE" } */
23 __analyzer_eval (base->m_second == 2); /* { dg-warning "TRUE" } */
24 }