aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/analyzer/compound-assignment-4.c
blob: 5c0a5f9d47c0bf1b603434746bd63f2577649e07 (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
26
27
28
#include "analyzer-decls.h"

struct coord
{
  int x;
  int y;
};

void test_1 (void)
{
  struct coord arr[16];

  arr[2].y = 4;
  arr[3].x = 5;
  arr[3].y = 6;
  arr[4].x = 7;
  arr[6].y = 8;
  arr[8].x = 9;

  arr[7] = arr[3];

  __analyzer_eval (arr[7].x == 5); /* { dg-warning "TRUE" } */
  __analyzer_eval (arr[7].y == 6); /* { dg-warning "TRUE" } */

  /* Make sure we don't touch the neighbors.  */
  __analyzer_eval (arr[6].y == 8); /* { dg-warning "TRUE" } */
  __analyzer_eval (arr[8].x == 9); /* { dg-warning "TRUE" } */
}