Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset tmp to nullptr everytime its used to avoid using corrupt values #30

Merged
merged 3 commits into from
Dec 21, 2023

Conversation

czgdp1807
Copy link
Collaborator

Achieved using OneTimeUseASRNode<T> for resetting value once read. Helps in avoiding usage of corrupt values generated from previous statements, expressions by making sure whenever get is called the tmp.node sets to nullptr. That way whenever we analyse the next expression/statement tmp.node is nullptr, so we will start afresh and won't be able to use anything from previous expression/statement even by mistake.

Addition of this uncovered a bug which I fixed in this PR itself.

DEV: Add OneTimeUseASRNode<T> for resetting value once read. Helps in avoiding usage of corrupt values generated from previous statements, expressions. Currently used for tmp member of AST visitor.
DEV: Add support NotEq operator.
@czgdp1807 czgdp1807 merged commit 54c21a1 into lcompilers:main Dec 21, 2023
2 checks passed
@certik
Copy link
Contributor

certik commented Dec 21, 2023

In Release mode we can then implement a version that does not set the result to nullptr, so there shouldn't be any overhead at runtime in Release mode. And it will still get reset in Debug mode, to catch bugs early.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants