mirror of
https://github.com/ziglang/zig.git
synced 2025-01-24 02:41:06 +00:00
fix tests
This commit is contained in:
parent
816689a3b1
commit
910a96f046
@ -10825,6 +10825,7 @@ static TypeTableEntry *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstruc
|
|||||||
if (array_type->data.array.len == 0) {
|
if (array_type->data.array.len == 0) {
|
||||||
ir_add_error_node(ira, elem_ptr_instruction->base.source_node,
|
ir_add_error_node(ira, elem_ptr_instruction->base.source_node,
|
||||||
buf_sprintf("index 0 outside array of size 0"));
|
buf_sprintf("index 0 outside array of size 0"));
|
||||||
|
return ira->codegen->builtin_types.entry_invalid;
|
||||||
}
|
}
|
||||||
TypeTableEntry *child_type = array_type->data.array.child_type;
|
TypeTableEntry *child_type = array_type->data.array.child_type;
|
||||||
if (ptr_type->data.pointer.unaligned_bit_count == 0) {
|
if (ptr_type->data.pointer.unaligned_bit_count == 0) {
|
||||||
|
@ -2014,7 +2014,7 @@ pub fn addCases(cases: &tests.CompileErrorContext) {
|
|||||||
|
|
||||||
cases.add("increase pointer alignment in @ptrCast",
|
cases.add("increase pointer alignment in @ptrCast",
|
||||||
\\export fn entry() -> u32 {
|
\\export fn entry() -> u32 {
|
||||||
\\ var bytes: [4]u8 align 4 = []u8{0x01, 0x02, 0x03, 0x04};
|
\\ var bytes: [4]u8 = []u8{0x01, 0x02, 0x03, 0x04};
|
||||||
\\ const ptr = @ptrCast(&u32, &bytes[0]);
|
\\ const ptr = @ptrCast(&u32, &bytes[0]);
|
||||||
\\ return *ptr;
|
\\ return *ptr;
|
||||||
\\}
|
\\}
|
||||||
|
Loading…
Reference in New Issue
Block a user