gcc/testsuite/gnat.dg/volatile4.adb
raw| 1 | -- { dg-do run } |
| 2 | |
| 3 | procedure Volatile4 is |
| 4 | |
| 5 | type My_Int is new Integer; |
| 6 | pragma Volatile (My_Int); |
| 7 | |
| 8 | type Rec is record |
| 9 | I : My_Int; |
| 10 | end record; |
| 11 | |
| 12 | function F (R : Rec) return Rec is |
| 13 | begin |
| 14 | return R; |
| 15 | end; |
| 16 | |
| 17 | R : Rec := (I => 0); |
| 18 | |
| 19 | begin |
| 20 | R := F (R); |
| 21 | if R.I /= 0 then |
| 22 | raise Program_Error; |
| 23 | end if; |
| 24 | end; |