Displaying 4 results from an estimated 4 matches for "copy_amt".
2017 Sep 16
2
assertion triggered since update to llvm 5
...{
var bytes: []const u8 = "format";
write(bytes);
}
pub fn write(bytes: []const u8) {
var index: usize = 0;
var src_index: usize = 0;
while (src_index < bytes.len) {
const dest_space_left = 1 - index;
const b = bytes.len - src_index;
const copy_amt = if (dest_space_left < b) dest_space_left else b;
index += copy_amt;
src_index += copy_amt;
}
}
pub fn panic(msg: []const u8) -> noreturn { while (true) {} }
compile with ./zig build_obj test.zig --release-safe
This does the equivalent of -O3
The IR that it produces;...
2017 Sep 17
2
assertion triggered since update to llvm 5
...pub fn write(bytes: []const u8) {
>> var index: usize = 0;
>>
>> var src_index: usize = 0;
>>
>> while (src_index < bytes.len) {
>> const dest_space_left = 1 - index;
>> const b = bytes.len - src_index;
>> const copy_amt = if (dest_space_left < b) dest_space_left else b;
>> index += copy_amt;
>> src_index += copy_amt;
>> }
>> }
>>
>> pub fn panic(msg: []const u8) -> noreturn { while (true) {} }
>>
>>
>> compile with ./zig build_obj test...
2017 Sep 17
4
assertion triggered since update to llvm 5
...x: usize = 0;
>>>>
>>>> var src_index: usize = 0;
>>>>
>>>> while (src_index < bytes.len) {
>>>> const dest_space_left = 1 - index;
>>>> const b = bytes.len - src_index;
>>>> const copy_amt = if (dest_space_left < b) dest_space_left else
>>>> b;
>>>> index += copy_amt;
>>>> src_index += copy_amt;
>>>> }
>>>> }
>>>>
>>>> pub fn panic(msg: []const u8) -> noreturn { while (true)...
2017 Sep 17
2
assertion triggered since update to llvm 5
...t;>
>>>>> var src_index: usize = 0;
>>>>>
>>>>> while (src_index < bytes.len) {
>>>>> const dest_space_left = 1 - index;
>>>>> const b = bytes.len - src_index;
>>>>> const copy_amt = if (dest_space_left < b) dest_space_left else
>>>>> b;
>>>>> index += copy_amt;
>>>>> src_index += copy_amt;
>>>>> }
>>>>> }
>>>>>
>>>>> pub fn panic(msg: []const u8) -&...