Skip to content

Conversation

@Thirumalai-Shaktivel
Copy link
Collaborator

@Thirumalai-Shaktivel Thirumalai-Shaktivel commented Apr 6, 2023

Fixes: #1667

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using your PR, please show the indented ASR for this code.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(TranslationUnit
    (SymbolTable
        1
        {
            _global_symbols:
                (Module
                    (SymbolTable
                        5
                        {
                            _lpython_main_program:
                                (Function
                                    (SymbolTable
                                        4
                                        {
                                            
                                        })
                                    _lpython_main_program
                                    (FunctionType
                                        []
                                        ()
                                        Source
                                        Implementation
                                        ()
                                        .false.
                                        .false.
                                        .false.
                                        .false.
                                        .false.
                                        []
                                        []
                                        .false.
                                    )
                                    [test]
                                    []
                                    [(=
                                        (Var 5 x)
                                        (FunctionCall
                                            5 test
                                            ()
                                            []
                                            (Integer 4 [])
                                            ()
                                            ()
                                        )
                                        ()
                                    )
                                    (=
                                        (Var 5 j)
                                        (Var 5 i)
                                        ()
                                    )]
                                    ()
                                    Public
                                    .false.
                                    .false.
                                ),
                            i:
                                (Variable
                                    5
                                    i
                                    []
                                    Local
                                    (IntegerConstant 10 (Integer 4 []))
                                    (IntegerConstant 10 (Integer 4 []))
                                    Default
                                    (Integer 4 [])
                                    Source
                                    Public
                                    Required
                                    .false.
                                ),
                            j:
                                (Variable
                                    5
                                    j
                                    []
                                    Local
                                    ()
                                    ()
                                    Default
                                    (Integer 4 [])
                                    Source
                                    Public
                                    Required
                                    .false.
                                ),
                            test:
                                (Function
                                    (SymbolTable
                                        2
                                        {
                                            _lpython_return_variable:
                                                (Variable
                                                    2
                                                    _lpython_return_variable
                                                    []
                                                    ReturnVar
                                                    ()
                                                    ()
                                                    Default
                                                    (Integer 4 [])
                                                    Source
                                                    Public
                                                    Required
                                                    .false.
                                                ),
                                            temp:
                                                (Variable
                                                    2
                                                    temp
                                                    []
                                                    Local
                                                    ()
                                                    ()
                                                    Default
                                                    (Integer 4 [])
                                                    Source
                                                    Public
                                                    Required
                                                    .false.
                                                )
                                        })
                                    test
                                    (FunctionType
                                        []
                                        (Integer 4 [])
                                        Source
                                        Implementation
                                        ()
                                        .false.
                                        .false.
                                        .false.
                                        .false.
                                        .false.
                                        []
                                        []
                                        .false.
                                    )
                                    []
                                    []
                                    [(=
                                        (Var 2 temp)
                                        (IntegerConstant 0 (Integer 4 []))
                                        ()
                                    )
                                    (=
                                        (Var 2 _lpython_return_variable)
                                        (Var 2 temp)
                                        ()
                                    )
                                    (Return)]
                                    (Var 2 _lpython_return_variable)
                                    Public
                                    .false.
                                    .false.
                                ),
                            x:
                                (Variable
                                    5
                                    x
                                    []
                                    Local
                                    ()
                                    ()
                                    Default
                                    (Integer 4 [])
                                    Source
                                    Public
                                    Required
                                    .false.
                                )
                        })
                    _global_symbols
                    []
                    .false.
                    .false.
                ),
            main_program:
                (Program
                    (SymbolTable
                        3
                        {
                            _lpython_main_program:
                                (ExternalSymbol
                                    3
                                    _lpython_main_program
                                    5 _lpython_main_program
                                    _global_symbols
                                    []
                                    _lpython_main_program
                                    Public
                                )
                        })
                    main_program
                    [_global_symbols]
                    [(SubroutineCall
                        3 _lpython_main_program
                        ()
                        []
                        ()
                    )]
                )
        })
    []
)

@certik certik requested a review from czgdp1807 April 7, 2023 20:08
Copy link
Collaborator

@czgdp1807 czgdp1807 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me.

@Thirumalai-Shaktivel
Copy link
Collaborator Author

Thanks of the approvals!

@Thirumalai-Shaktivel Thirumalai-Shaktivel merged commit fb0428c into lcompilers:main Apr 8, 2023
@Thirumalai-Shaktivel Thirumalai-Shaktivel deleted the var_init branch April 8, 2023 06:47
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.

Bug: "x : i32 = test()" fails at top level

3 participants