mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
Sema: add missed logic to checkPtrAttributes
It wasn't checking bit pointer data.
This commit is contained in:
parent
7ffe068a79
commit
725dec6aa7
13
src/Sema.zig
13
src/Sema.zig
@ -30670,6 +30670,19 @@ fn checkPtrAttributes(sema: *Sema, dest_ty: Type, inst_ty: Type, in_memory_resul
|
|||||||
} };
|
} };
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (inst_info.packed_offset.host_size != dest_info.packed_offset.host_size or
|
||||||
|
inst_info.packed_offset.bit_offset != dest_info.packed_offset.bit_offset)
|
||||||
|
{
|
||||||
|
in_memory_result.* = .{ .ptr_bit_range = .{
|
||||||
|
.actual_host = inst_info.packed_offset.host_size,
|
||||||
|
.wanted_host = dest_info.packed_offset.host_size,
|
||||||
|
.actual_offset = inst_info.packed_offset.bit_offset,
|
||||||
|
.wanted_offset = dest_info.packed_offset.bit_offset,
|
||||||
|
} };
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -14,6 +14,7 @@ fn bar(x: *u32) void {
|
|||||||
|
|
||||||
// error
|
// error
|
||||||
//
|
//
|
||||||
// :8:9: error: expected type '*u32', found '*align(1) u32'
|
// :8:9: error: expected type '*u32', found '*align(8:8:8) u32'
|
||||||
// :8:9: note: pointer alignment '1' cannot cast into pointer alignment '4'
|
// :8:9: note: pointer host size '8' cannot cast into pointer host size '0'
|
||||||
|
// :8:9: note: pointer bit offset '8' cannot cast into pointer bit offset '0'
|
||||||
// :11:11: note: parameter type declared here
|
// :11:11: note: parameter type declared here
|
||||||
|
|||||||
@ -15,5 +15,6 @@ fn bar(x: []u32) void {
|
|||||||
|
|
||||||
// error
|
// error
|
||||||
//
|
//
|
||||||
// :9:22: error: expected type '*[1]u32', found '*align(1) u32'
|
// :9:22: error: expected type '*[1]u32', found '*align(8:8:8) u32'
|
||||||
// :9:22: note: pointer alignment '1' cannot cast into pointer alignment '4'
|
// :9:22: note: pointer host size '8' cannot cast into pointer host size '0'
|
||||||
|
// :9:22: note: pointer bit offset '8' cannot cast into pointer bit offset '0'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user