Fix evaluating array address in IR compiler
This commit is contained in:
parent
6863cdf567
commit
3ea319f7bf
1 changed files with 2 additions and 4 deletions
|
|
@ -536,9 +536,7 @@ namespace pslang::ir
|
|||
node_ref base_ptr;
|
||||
if (array_type)
|
||||
{
|
||||
auto array = apply(*array_access->array);
|
||||
mcontext.nodes->emplace_back(cast_operation{array, target_pointer_type}, target_pointer_type);
|
||||
base_ptr = last();
|
||||
base_ptr = apply_get_address(array_access->array).value();
|
||||
}
|
||||
else // if (pointer_type)
|
||||
{
|
||||
|
|
@ -611,7 +609,7 @@ namespace pslang::ir
|
|||
// Evaluating variable initializer didn't produce any nodes
|
||||
// It must have been just a reference to another variable or smth like that
|
||||
// Introduce a copy node to prevent accidental variable coalescing
|
||||
mcontext.nodes->emplace_back(copy{result});
|
||||
mcontext.nodes->emplace_back(copy{result}, node.inferred_type);
|
||||
result = last();
|
||||
}
|
||||
lcontext.variables[&node] = result;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue