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" } */
6
7 #include <stdlib.h>
8
some_call(int i,char ch)9 int some_call (int i, char ch)
10 {
11 return i * i;
12 }
13
test(int * buf,int n,int * out)14 int *test (int *buf, int n, int *out)
15 {
16 int i;
17 int *result = 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" "" { xfail *-*-* } } */
22 /* TODO(xfail): why isn't the warning appearing? */
23
24 /* Example of a "'" (to test quoting). */
25 *out = some_call (i, 'a');
26
27 return result;
28 }
29
30 /* Test that we can generate valid .dot files given a BB with no
31 statements. */
32 extern int func ();
test_2(void)33 int test_2 (void)
34 {
35 int c1;
36 do
37 {
38 c1 = func ();
39 if (c1 == '\0')
40 break;
41 }
42 while (c1);
43 return c1;
44 }
45
46 /* { dg-final { dg-check-dot "dot-output.c.callgraph.dot" } } */
47 /* { dg-final { dg-check-dot "dot-output.c.eg.dot" } } */
48 /* { dg-final { dg-check-dot "dot-output.c.state-purge.dot" } } */
49 /* { dg-final { dg-check-dot "dot-output.c.supergraph.dot" } } */
50 /* { dg-final { dg-check-dot "dot-output.c.supergraph-eg.dot" } } */
51