You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It also appears to be doing a memcpy from the global bit_set (address 0x10f5000).
As far as I can tell, ArrayBitSet(usize, 1_000_000_000).setRangeValue takes a pointer to the bitset so there should be no need to copy this to the stack before calling this function.
Expected Behavior
The code should just run without a seg fault.
Actually, I expect that no memcpy of the global pointer into the local stack would happen, and the call to setRangeValue would just take the pointer to the global.
The text was updated successfully, but these errors were encountered:
This is despite the obvious fact that the Self parameter is not used, and it is only referencing the global defined in the ArrayBitSet function return type. This is illustrated by looking at the generated code for the non-inline capacity function.
000000000103b410 <test.ArrayBitSet.capacity>:
103b410: 55 push %rbp
103b411: 48 89 e5 mov %rsp,%rbp
103b414: b8 50 d6 dc 01 mov $0x1dcd650,%eax
103b419: 5d pop %rbp
103b41a: c3 ret
However, when the inline function is 'called', a complete copy of the bit_set global variable is created on the function call stack and then the function is called.
This is therefore easy to compare the call sites for the two instances of capacity.
Zig Version
0.14.0-dev.2599+ff4f2753e
Steps to Reproduce and Observed Behavior
with the code:
and compiled with
The executable seg faults.
By the looks of the
objdump -d
this is attempting to do a__zig_probe_stack
with the size 0x7735950 - this obviously fails.It also appears to be doing a memcpy from the global bit_set (address 0x10f5000).
As far as I can tell, ArrayBitSet(usize, 1_000_000_000).setRangeValue takes a pointer to the bitset so there should be no need to copy this to the stack before calling this function.
Expected Behavior
The code should just run without a seg fault.
Actually, I expect that no memcpy of the global pointer into the local stack would happen, and the call to setRangeValue would just take the pointer to the global.
The text was updated successfully, but these errors were encountered: