1 /* { dg-do compile }  */
2 /* { dg-options "-O2 -fdump-tree-optimized -w" }  */
3 
4 void *arf ();
5 int
foo(void (* q)(void))6 foo(void (*q)(void))
7 {
8   int r = q;
9 
10   if (r != 0)
11     return 1;
12   else
13     return 2;
14 }
15 
16 /* The cast to an int type must remain after all optimizations are complete
17    so that we do not try to canonicalize a function pointer for the
18    comparison when no such canonicalization is wanted.  */
19 /* { dg-final { scan-tree-dump-times "r_. = \\(int\\) q" 1 "optimized" } } */
20 
21