PR middle-end/77357 - strlen of constant strings not folded
[official-gcc.git] / gcc / testsuite / gcc.dg / pr33826.c
blobdf839151661daac84c2f686c510012c873350db7
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" } */
8 int recurse1 (int);
9 int recurse2b (int);
10 int norecurse1b (int);
12 int recurese1 (int i)
14 return recurse1 (i+1);
17 int recurse2a (int i)
19 return recurse2b (i+1);
22 int recurse2b (int i)
24 return recurse2a (i+1);
27 int norecurse1a (int i)
29 return norecurse1b (i+1);
32 int norecurse1b (int i)
34 return i+1;
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" } } */