Debian Codegraph @

gcc/testsuite/gcc.dg/pr33826.c

raw
1 /* Regression test for PR middle-end/33826 */
2 /* Verify that recursive functions cannot be pure or const. */
3
4 /* { dg-do compile { target { nonpic || pie_enabled } } } */
5 /* { dg-options "-O1 -fdump-tree-local-pure-const1 -fdump-ipa-pure-const" } */
6
7 int recurse1 (int);
8 int recurse2b (int);
9 int norecurse1b (int);
10
11 int recurese1 (int i)
12 {
13 return recurse1 (i+1);
14 }
15
16 int recurse2a (int i)
17 {
18 return recurse2b (i+1);
19 }
20
21 int recurse2b (int i)
22 {
23 return recurse2a (i+1);
24 }
25
26 int norecurse1a (int i)
27 {
28 return norecurse1b (i+1);
29 }
30
31 int norecurse1b (int i)
32 {
33 return i+1;
34 }
35
36 /* { dg-final { scan-tree-dump "found to be const: norecurse1a" "local-pure-const1" } } */
37 /* { dg-final { scan-tree-dump "found to be const: norecurse1b" "local-pure-const1" } } */
38 /* { dg-final { scan-tree-dump-not "found to be pure: recurse1" "local-pure-const1" } } */
39 /* { dg-final { scan-tree-dump-not "found to be pure: recurse2a" "local-pure-const1" } } */
40 /* { dg-final { scan-tree-dump-not "found to be pure: recurse2b" "local-pure-const1" } } */
41 /* { dg-final { scan-tree-dump-not "found to be const: recurse1" "local-pure-const1" } } */
42 /* { dg-final { scan-tree-dump-not "found to be const: recurse2a" "local-pure-const1" } } */
43 /* { dg-final { scan-tree-dump-not "found to be const: recurse2b" "local-pure-const1" } } */
44 /* { dg-final { scan-ipa-dump-not "found to be pure: recurse1" "pure-const" } } */
45 /* { dg-final { scan-ipa-dump-not "found to be pure: recurse2a" "pure-const" } } */
46 /* { dg-final { scan-ipa-dump-not "found to be pure: recurse2b" "pure-const" } } */
47 /* { dg-final { scan-ipa-dump-not "found to be const: recurse1" "pure-const" } } */
48 /* { dg-final { scan-ipa-dump-not "found to be const: recurse2a" "pure-const" } } */
49 /* { dg-final { scan-ipa-dump-not "found to be const: recurse2b" "pure-const" } } */