gcc/testsuite/gnat.dg/overflow_sum3.adb
raw| 1 | -- { dg-do run } |
| 2 | -- { dg-options "-gnato" } |
| 3 | |
| 4 | procedure Overflow_Sum3 is |
| 5 | |
| 6 | function Ident (I : Integer) return Integer is |
| 7 | begin |
| 8 | return I; |
| 9 | end; |
| 10 | |
| 11 | X : Short_Short_Integer := Short_Short_Integer (Ident (127)); |
| 12 | |
| 13 | begin |
| 14 | if X+1 <= 127 then |
| 15 | raise Program_Error; |
| 16 | end if; |
| 17 | exception |
| 18 | when Constraint_Error => null; |
| 19 | end; |