gcc/testsuite/gnat.dg/opt14.adb
raw| 1 | -- { dg-do run } |
| 2 | -- { dg-options "-O2" } |
| 3 | |
| 4 | procedure Opt14 is |
| 5 | |
| 6 | type Rec is record |
| 7 | I1, I2, I3 : Integer; |
| 8 | end record; |
| 9 | |
| 10 | type Ptr is access Rec; |
| 11 | |
| 12 | P : Ptr := new Rec'(0,0,0); |
| 13 | |
| 14 | procedure Sub (R : In Out Rec) is |
| 15 | begin |
| 16 | R.I3 := R.I3 - 1; |
| 17 | end; |
| 18 | |
| 19 | begin |
| 20 | P.all := (1,2,3); |
| 21 | Sub (P.all); |
| 22 | if P.all /= (1,2,2) then |
| 23 | raise Program_Error; |
| 24 | end if; |
| 25 | end; |