Skip several analyzer socket tests on hppa*-*-hpux*
[official-gcc.git] / gcc / testsuite / c-c++-common / analyzer / paths-6.c
blobef1a4e6c04d1c29def3c7e10c094441d21d23d8d
1 #include <stdlib.h>
2 #include "analyzer-decls.h"
4 /* Verify that ordering of writes doesn't matter when merging states. */
6 /* Test with locals. */
8 void test_1 (int flag)
10 int a, b;
11 if (flag)
13 a = 3;
14 b = 4;
16 else
18 b = 4;
19 a = 3;
22 __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */
23 __analyzer_eval (a == 3); /* { dg-warning "TRUE" } */
24 __analyzer_eval (b == 4); /* { dg-warning "TRUE" } */
27 /* Test with globals. */
29 int f, g, h;
30 void test_2 (int flag)
32 if (flag)
34 f = 3;
35 g = 4;
37 else
39 g = 4;
40 f = 3;
43 __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */
44 __analyzer_eval (f == 3); /* { dg-warning "TRUE" } */
45 __analyzer_eval (g == 4); /* { dg-warning "TRUE" } */
48 /* All 6 orderings of writes to 3 globals. */
50 void test_3 (int i)
52 switch (i)
54 default:
55 case 0:
56 f = 3;
57 g = 4;
58 h = 5;
59 break;
61 case 1:
62 f = 3;
63 h = 5;
64 g = 4;
65 break;
67 case 2:
68 g = 4;
69 f = 3;
70 h = 5;
71 break;
73 case 3:
74 g = 4;
75 h = 5;
76 f = 3;
77 break;
79 case 4:
80 h = 5;
81 f = 3;
82 g = 4;
83 break;
85 case 5:
86 h = 5;
87 g = 4;
88 f = 3;
89 break;
92 __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */
93 __analyzer_eval (f == 3); /* { dg-warning "TRUE" } */
94 __analyzer_eval (g == 4); /* { dg-warning "TRUE" } */
95 __analyzer_eval (h == 5); /* { dg-warning "TRUE" } */
98 void test_4 (int flag)
100 void *p, *q;
101 if (flag)
103 p = malloc (256);
104 q = malloc (256);
106 else
108 q = malloc (256);
109 p = malloc (256);
111 __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enode" } */
112 free (p);
113 free (q);