1 /* Regression test for PR middle-end/33826 */
2 /* Verify that recursive functions cannot be pure or const. */
4 /* { dg-do compile } */
5 /* { dg-require-effective-target nonpic } */
6 /* { dg-options "-O1 -fdump-tree-local-pure-const1 -fdump-ipa-pure-const" } */
10 int norecurse1b (int);
14 return recurse1 (i
+1);
19 return recurse2b (i
+1);
24 return recurse2a (i
+1);
27 int norecurse1a (int i
)
29 return norecurse1b (i
+1);
32 int norecurse1b (int i
)
37 /* { dg-final { scan-tree-dump "found to be const: norecurse1a" "local-pure-const1" } } */
38 /* { dg-final { scan-tree-dump "found to be const: norecurse1b" "local-pure-const1" } } */
39 /* { dg-final { scan-tree-dump-not "found to be pure: recurse1" "local-pure-const1" } } */
40 /* { dg-final { scan-tree-dump-not "found to be pure: recurse2a" "local-pure-const1" } } */
41 /* { dg-final { scan-tree-dump-not "found to be pure: recurse2b" "local-pure-const1" } } */
42 /* { dg-final { scan-tree-dump-not "found to be const: recurse1" "local-pure-const1" } } */
43 /* { dg-final { scan-tree-dump-not "found to be const: recurse2a" "local-pure-const1" } } */
44 /* { dg-final { scan-tree-dump-not "found to be const: recurse2b" "local-pure-const1" } } */
45 /* { dg-final { scan-ipa-dump-not "found to be pure: recurse1" "pure-const" } } */
46 /* { dg-final { scan-ipa-dump-not "found to be pure: recurse2a" "pure-const" } } */
47 /* { dg-final { scan-ipa-dump-not "found to be pure: recurse2b" "pure-const" } } */
48 /* { dg-final { scan-ipa-dump-not "found to be const: recurse1" "pure-const" } } */
49 /* { dg-final { scan-ipa-dump-not "found to be const: recurse2a" "pure-const" } } */
50 /* { dg-final { scan-ipa-dump-not "found to be const: recurse2b" "pure-const" } } */
51 /* { dg-final { cleanup-ipa-dump "pure-const" } } */
52 /* { dg-final { cleanup-tree-dump "local-pure-const1" } } */