gcc/testsuite/gnat.dg/address_conversion.adb
raw| 1 | -- { dg-do run } |
| 2 | -- { dg-options "-O2" } |
| 3 | |
| 4 | with System.Address_To_Access_Conversions; |
| 5 | |
| 6 | procedure address_conversion is |
| 7 | |
| 8 | type Integer_type1 is new Integer; |
| 9 | type Integer_type2 is new Integer; |
| 10 | |
| 11 | package AA is new System.Address_To_Access_Conversions (Integer_type1); |
| 12 | |
| 13 | K1 : Integer_type1; |
| 14 | K2 : Integer_type2; |
| 15 | |
| 16 | begin |
| 17 | K1 := 1; |
| 18 | K2 := 2; |
| 19 | |
| 20 | AA.To_Pointer(K2'Address).all := K1; |
| 21 | if K2 /= 1 then |
| 22 | raise Program_Error; |
| 23 | end if; |
| 24 | end; |