gcc/testsuite/gnat.dg/discr39.adb
raw| 1 | -- { dg-do run } |
| 2 | |
| 3 | with System.Storage_Elements; use System.Storage_Elements; |
| 4 | |
| 5 | procedure Discr39 is |
| 6 | |
| 7 | type Rec (Has_Src : Boolean) is record |
| 8 | case Has_Src is |
| 9 | when True => Src : aliased Integer; |
| 10 | when False => null; |
| 11 | end case; |
| 12 | end record; |
| 13 | pragma Pack(Rec); |
| 14 | for Rec'Alignment use Integer'Alignment; |
| 15 | |
| 16 | R : Rec (Has_Src => True); |
| 17 | |
| 18 | begin |
| 19 | if R.Src'Address mod Integer'Alignment /= 0 then |
| 20 | raise Program_Error; |
| 21 | end if; |
| 22 | end; |