Debian Codegraph @

gcc/testsuite/gcc.dg/analyzer/data-model-15.c

raw
1 #include <string.h>
2
3 struct coord
4 {
5 double x;
6 double y;
7 double z;
8 };
9
10 struct tri {
11 struct coord verts[3];
12 };
13
14 double test_1 (void)
15 {
16 struct tri t;
17 memset (&t, 0, sizeof (struct tri));
18 return t.verts[1].y;
19 }
20
21 int test_2 (const struct coord *c1, const struct coord *c2, double r_squared)
22 {
23 double dx = c1->x - c2->x;
24 double dy = c1->y - c2->y;
25 double dz = c1->z - c2->z;
26 return (dx * dx) + (dy * dy) + (dz * dz) <= r_squared;
27 }
28
29 int test_3 (const struct coord *c1, const struct coord *c2, struct coord *out)
30 {
31 out->x = c1->x + c2->x;
32 out->y = c1->y + c2->y;
33 out->z = c1->z + c2->z;
34 }