-
Notifications
You must be signed in to change notification settings - Fork 163
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
Added support for freeing variables in the ASR symbolic pass #2268
Conversation
I have a doubt . I'm seeing some cases work, for example
Through the pass I can see this block
But when I have
I get the following error
cc @Thirumalai-Shaktivel , I did some debugging but not exactly sure where I might be going wrong . |
Here is the issue for the ASR verify failure: ASRsymbol_set:
(Function
(SymbolTable
8
{
s:
(Variable
8
s
[]
In
()
()
Default
(Character 1 -2 ())
()
BindC
Public
Required
.true.
),
x:
(Variable
8
x
[]
In
()
()
Default
(CPtr)
()
BindC
Public
Required
.true.
)
})
symbol_set
(FunctionType
[(CPtr)
(Character 1 -2 ())]
()
BindC
Interface
"symbol_set"
.false.
.false.
.false.
.false.
.false.
[]
.false.
)
[]
[(Var 8 x)
(Var 8 s)]
[(SubroutineCall <---------------------
2 basic_free_stack
2 basic_free_stack
[((Var 3 x))]
()
)]
()
Public
.false.
.false.
"symengine/cwrapper.h"
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left one suggestion, otherwise this LGTM!
I've addressed the suggested change , should be ready now. |
Thanks! I think it looks good. I rebased it to make sure it still works and I set it to merge. |
The framework here is simple
basic_new_stack
would be required to allocate memory , that's enough information to confirm that the corresponding variable would also have to be freed at the end of the program. Hence I've declaredbasic_free_stack
accordingly.symbolic_vars
which has all CPtr symbols that have been added to the function's symbol table.main0()