gcc/testsuite/gnat.dg/case_optimization1.adb
raw| 1 | -- { dg-do compile } |
| 2 | -- { dg-options "-O2" } |
| 3 | |
| 4 | package body Case_Optimization1 is |
| 5 | |
| 6 | function F (Op_Kind : Internal_Operator_Symbol_Kinds) return Integer is |
| 7 | begin |
| 8 | case Op_Kind is |
| 9 | when A_Not_Operator => return 3; |
| 10 | when An_Exponentiate_Operator => return 2; |
| 11 | when others => return 1; |
| 12 | end case; |
| 13 | end; |
| 14 | |
| 15 | function Len (E : Element) return Integer is |
| 16 | Op_Kind : Internal_Element_Kinds := Int_Kind (E); |
| 17 | begin |
| 18 | return F (Int_Kind (E)); |
| 19 | end; |
| 20 | |
| 21 | end Case_Optimization1; |