-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Code to reproduce
routine modify(x : integer) is
x := 2;
println x;
return;
end
routine main() is
modify(5);
return;
endExpected behavior
Prints 2
Actual behavior
[AST]:
<Program>
| <RoutineDeclaration>
| | <Body>
| | | <AssignmentStatement>
| | | | <Identifier>
| | | | </Identifier>
cplus: /usr/lib/llvm-10/include/llvm/IR/Type.h:382: llvm::Type* llvm::Type::getPointerElementType() const: Assertion `getTypeID() == PointerTyID' failed.
./run.sh: line 5: 73279 Aborted (core dumped) ./build/cplus -d examples/sample.cp
Notes
- This happens because the assignment statement tries to access the location of x by visiting the identifier node, which assigns to
tmp_vrather thantmp_pin cast of argument (from args_table) - One way to solve this would be to make args_table return pointers instead of values (like ptrs_table), but this would require modifications in RoutineDeclarations.
- We may actually use only one table (ptrs_table) and remove (args_table)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working