Duncan Sands | 2b5243d | 2010-11-25 21:21:59 +0000 | [diff] [blame] | 1 | -- RUN: %llvmgcc -S %s |
Duncan Sands | ec0a98f | 2009-10-22 10:02:10 +0000 | [diff] [blame] | 2 | with System; |
| 3 | procedure Negative_Field_Offset (N : Integer) is |
| 4 | type String_Pointer is access String; |
| 5 | -- Force use of a thin pointer. |
| 6 | for String_Pointer'Size use System.Word_Size; |
| 7 | P : String_Pointer; |
Duncan Sands | 2a53674 | 2009-10-22 12:53:25 +0000 | [diff] [blame] | 8 | |
| 9 | procedure Q (P : String_Pointer) is |
| 10 | begin |
| 11 | P (1) := 'Z'; |
| 12 | end; |
Duncan Sands | ec0a98f | 2009-10-22 10:02:10 +0000 | [diff] [blame] | 13 | begin |
| 14 | P := new String (1 .. N); |
Duncan Sands | 2a53674 | 2009-10-22 12:53:25 +0000 | [diff] [blame] | 15 | Q (P); |
Duncan Sands | ec0a98f | 2009-10-22 10:02:10 +0000 | [diff] [blame] | 16 | end; |