summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/analyzer/data-model-8.c
blob: 3e69d0f8aa5a4511eb14b6f0f92b681fef2c3544 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include "analyzer-decls.h"

struct base
{
  int i;
};

struct sub
{
  struct base b;
  int j;
};

void test (void)
{
  struct sub s;
  s.b.i = 3;
  s.j = 4;
  __analyzer_eval (s.b.i == 3); /* { dg-warning "TRUE" } */
  __analyzer_eval (s.j == 4); /* { dg-warning "TRUE" } */

  struct base *bp = (struct base *)&s;

  __analyzer_eval (bp->i == 3); /* { dg-warning "TRUE" } */
}