| 1 | export fn entry1() void { |
| 2 | const x: u32 = 123; |
| 3 | const ptr: [*]const u32 = @ptrCast(&x); |
| 4 | _ = ptr - 1; |
| 5 | } |
| 6 | |
| 7 | export fn entry2() void { |
| 8 | const S = extern struct { x: u32, y: u32 }; |
| 9 | const y: u32 = 123; |
| 10 | const parent_ptr: *const S = @fieldParentPtr("y", &y); |
| 11 | _ = parent_ptr; |
| 12 | } |
| 13 | |
| 14 | // error |
| 15 | // |
| 16 | // :4:13: error: pointer computation here causes illegal behavior |
| 17 | // :4:13: note: resulting pointer exceeds bounds of containing value which may trigger overflow |
| 18 | // :10:55: error: pointer computation here causes illegal behavior |
| 19 | // :10:55: note: resulting pointer exceeds bounds of containing value which may trigger overflow |