| author | |
| committer | |
| log | 910a96f0468c635a135d9fccd39f139ba0775ef9 |
| tree | 7a8873846ea70892414e79585e5c64f3a0ccfa67 |
| parent | 816689a3b1c98ec008438e7f868e1a123889b2a7 |
2 files changed, 2 insertions(+), 1 deletions(-)
src/ir.cpp+1| ... | @@ -10825,6 +10825,7 @@ static TypeTableEntry *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstruc | ... | @@ -10825,6 +10825,7 @@ static TypeTableEntry *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstruc |
| 10825 | if (array_type->data.array.len == 0) { | 10825 | if (array_type->data.array.len == 0) { |
| 10826 | ir_add_error_node(ira, elem_ptr_instruction->base.source_node, | 10826 | ir_add_error_node(ira, elem_ptr_instruction->base.source_node, |
| 10827 | buf_sprintf("index 0 outside array of size 0")); | 10827 | buf_sprintf("index 0 outside array of size 0")); |
| 10828 | return ira->codegen->builtin_types.entry_invalid; | ||
| 10828 | } | 10829 | } |
| 10829 | TypeTableEntry *child_type = array_type->data.array.child_type; | 10830 | TypeTableEntry *child_type = array_type->data.array.child_type; |
| 10830 | if (ptr_type->data.pointer.unaligned_bit_count == 0) { | 10831 | if (ptr_type->data.pointer.unaligned_bit_count == 0) { |
test/compile_errors.zig+1-1| ... | @@ -2014,7 +2014,7 @@ pub fn addCases(cases: &tests.CompileErrorContext) { | ... | @@ -2014,7 +2014,7 @@ pub fn addCases(cases: &tests.CompileErrorContext) { |
| 2014 | 2014 | ||
| 2015 | cases.add("increase pointer alignment in @ptrCast", | 2015 | cases.add("increase pointer alignment in @ptrCast", |
| 2016 | \\export fn entry() -> u32 { | 2016 | \\export fn entry() -> u32 { |
| 2017 | \\ var bytes: [4]u8 align 4 = []u8{0x01, 0x02, 0x03, 0x04}; | 2017 | \\ var bytes: [4]u8 = []u8{0x01, 0x02, 0x03, 0x04}; |
| 2018 | \\ const ptr = @ptrCast(&u32, &bytes[0]); | 2018 | \\ const ptr = @ptrCast(&u32, &bytes[0]); |
| 2019 | \\ return *ptr; | 2019 | \\ return *ptr; |
| 2020 | \\} | 2020 | \\} |