aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/analyzer/data-model-15.c
blob: 12e84a12420b159e2bef31c7008d4f2614114d20 (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
29
30
31
32
33
34
#include <string.h>

struct coord
{
  double x;
  double y;
  double z;
};

struct tri {
  struct coord verts[3];
};

double test_1 (void)
{
  struct tri t;
  memset (&t, 0, sizeof (struct tri));
  return t.verts[1].y;
}

int test_2 (const struct coord *c1, const struct coord *c2, double r_squared)
{
  double dx = c1->x - c2->x;
  double dy = c1->y - c2->y;
  double dz = c1->z - c2->z;
  return (dx * dx) + (dy * dy) + (dz * dz) <= r_squared;
}

int test_3 (const struct coord *c1, const struct coord *c2, struct coord *out)
{
  out->x = c1->x + c2->x;
  out->y = c1->y + c2->y;
  out->z = c1->z + c2->z;
}