gcc/testsuite/gnat.dg/object_overflow5.adb
raw| 1 | -- { dg-do compile } |
| 2 | |
| 3 | with Interfaces.C; use Interfaces.C; |
| 4 | |
| 5 | procedure Object_Overflow5 is |
| 6 | |
| 7 | procedure Proc (c : Character) is begin null; end; |
| 8 | |
| 9 | type Index_T is new ptrdiff_t range 0 .. ptrdiff_t'Last; |
| 10 | |
| 11 | type Arr is array(Index_T range <>) of Character; |
| 12 | |
| 13 | type Rec (Size: Index_T := 6) is record -- { dg-warning "Storage_Error" } |
| 14 | A: Arr (0..Size); |
| 15 | end record; |
| 16 | |
| 17 | Obj : Rec; -- { dg-warning "Storage_Error" } |
| 18 | |
| 19 | begin |
| 20 | Obj.A(1) := 'a'; |
| 21 | Proc (Obj.A(1)); |
| 22 | end; |