Skip to content

Commit

Permalink
fix #940: ensure full-sized ptr addresses in ASM mode
Browse files Browse the repository at this point in the history
  • Loading branch information
nunoplopes committed Sep 25, 2023
1 parent f65a7fb commit fc89df2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions ir/memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,7 @@ static StateValue bytesToValue(const Memory &m, const vector<Byte> &bytes,
// allow ptr->int type punning in Assembly mode
if (bitsize == bits_program_pointer &&
has_null_block && // a ptr load in src sets this to true
does_ptr_mem_access &&
m.getState().getFn().getFnAttrs().has(FnAttrs::Asm)) {
StateValue ptr_val = bytesToValue(m, bytes, PtrType(0));
ptr_val.value = Pointer(m, ptr_val.value).getAddress();
Expand Down
3 changes: 3 additions & 0 deletions tools/transform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1187,6 +1187,9 @@ static void calculateAndInitConstants(Transform &t) {
bits_ptr_address = min(max(bits_size_t, bits_ptr_address) + has_local_bit,
bits_program_pointer);

if (config::tgt_is_asm)
bits_ptr_address = bits_program_pointer;

bits_byte = 8 * (does_mem_access ? (unsigned)min_access_size : 1);

bits_poison_per_byte = 1;
Expand Down

0 comments on commit fc89df2

Please sign in to comment.