Sh3b0 / cplus

Compiler for an imperative toy programming language
MIT License
4 stars 2 forks source link

Assigning new values to arguments #9

Open Sh3b0 opened 2 years ago

Sh3b0 commented 2 years ago

Code to reproduce

routine modify(x : integer) is
    x := 2;
    println x;
    return;
end

routine main() is
    modify(5);
    return;
end

Expected 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