Debian Codegraph @

gcc/testsuite/c-c++-common/analyzer/dot-output.c

raw
1 /* Verify that the various .dot output files from the analyzer are readable
2 by .dot. */
3
4 /* { dg-require-dot "" } */
5 /* { dg-additional-options "-fdump-analyzer-callgraph -fdump-analyzer-exploded-graph -fdump-analyzer-state-purge -fdump-analyzer-supergraph -fdump-analyzer-feasibility" } */
6
7 #include <stdlib.h>
8
9 int some_call (int i, char ch)
10 {
11 return i * i;
12 }
13
14 int *test (int *buf, int n, int *out)
15 {
16 int i;
17 int *result = (int *) malloc (sizeof (int) * n);
18
19 /* A loop, to ensure we have phi nodes. */
20 for (i = 0; i < n; i++)
21 result[i] = buf[i] + i; /* { dg-warning "possibly-NULL" } */
22
23 /* Example of a "'" (to test quoting). */
24 *out = some_call (i, 'a');
25
26 return result;
27 }
28
29 /* Test that we can generate valid .dot files given a BB with no
30 statements. */
31 extern int func ();
32 int test_2 (void)
33 {
34 int c1;
35 do
36 {
37 c1 = func ();
38 if (c1 == '\0')
39 break;
40 }
41 while (c1);
42 return c1;
43 }
44
45 /* { dg-final { dg-check-dot "dot-output.c.callgraph.dot" } } */
46 /* { dg-final { dg-check-dot "dot-output.c.eg.dot" } } */
47 /* { dg-final { dg-check-dot "dot-output.c.state-purge.dot" } } */
48 /* { dg-final { dg-check-dot "dot-output.c.supergraph.dot" } } */
49 /* { dg-final { dg-check-dot "dot-output.c.supergraph-eg.dot" } } */