2014-04-15 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / pr33826.c
blobc091bbcdb107a839ecb8422e8bc08980be99429a
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 recurese1 (int i)
10 return recurse1 (i+1);
13 int recurse2a (int i)
15 return recurse2b (i+1);
18 int recurse2b (int i)
20 return recurse2a (i+1);
23 int norecurse1a (int i)
25 return norecurse1b (i+1);
28 int norecurse1b (int i)
30 return i+1;
33 /* { dg-final { scan-tree-dump "found to be const: norecurse1a" "local-pure-const1" } } */
34 /* { dg-final { scan-tree-dump "found to be const: norecurse1b" "local-pure-const1" } } */
35 /* { dg-final { scan-tree-dump-not "found to be pure: recurse1" "local-pure-const1" } } */
36 /* { dg-final { scan-tree-dump-not "found to be pure: recurse2a" "local-pure-const1" } } */
37 /* { dg-final { scan-tree-dump-not "found to be pure: recurse2b" "local-pure-const1" } } */
38 /* { dg-final { scan-tree-dump-not "found to be const: recurse1" "local-pure-const1" } } */
39 /* { dg-final { scan-tree-dump-not "found to be const: recurse2a" "local-pure-const1" } } */
40 /* { dg-final { scan-tree-dump-not "found to be const: recurse2b" "local-pure-const1" } } */
41 /* { dg-final { scan-ipa-dump-not "found to be pure: recurse1" "pure-const" } } */
42 /* { dg-final { scan-ipa-dump-not "found to be pure: recurse2a" "pure-const" } } */
43 /* { dg-final { scan-ipa-dump-not "found to be pure: recurse2b" "pure-const" } } */
44 /* { dg-final { scan-ipa-dump-not "found to be const: recurse1" "pure-const" } } */
45 /* { dg-final { scan-ipa-dump-not "found to be const: recurse2a" "pure-const" } } */
46 /* { dg-final { scan-ipa-dump-not "found to be const: recurse2b" "pure-const" } } */
47 /* { dg-final { cleanup-ipa-dump "pure-const" } } */
48 /* { dg-final { cleanup-tree-dump "local-pure-const1" } } */