GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Allow global variable initialisation only using the compile_item value by Thirumalai-Shaktivel · Pull Request #1672 · lcompilers/lpython

Conversation

@Thirumalai-Shaktivel

@Thirumalai-Shaktivel Thirumalai-Shaktivel commented Apr 6, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

Fixes: #1667

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Thirumalai-Shaktivel added 2 commits April 6, 2023 16:27
@Thirumalai-Shaktivel
Allow global initialization only using the compile_item value,
77c8016
Otherwise, use an assignment statement to initialize the variable.
@Thirumalai-Shaktivel
Register a test in CMakeLists
01e1216
czgdp1807
czgdp1807 reviewed Apr 7, 2023
View reviewed changes
Comment thread integration_tests/global_syms_06.py

@czgdp1807 czgdp1807 Apr 7, 2023

Copy link
Copy Markdown
Collaborator

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.

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@Thirumalai-Shaktivel Thirumalai-Shaktivel Apr 7, 2023

Copy link
Copy Markdown
Collaborator Author

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.

(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
                        ()
                        []
                        ()
                    )]
                )
        })
    []
)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
certik
certik approved these changes Apr 7, 2023
View reviewed changes
@certik
certik requested a review from czgdp1807 April 7, 2023 20:08
czgdp1807
czgdp1807 approved these changes Apr 8, 2023
View reviewed changes

@czgdp1807 czgdp1807 left a comment

Copy link
Copy Markdown
Collaborator

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.

Makes sense to me.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Thirumalai-Shaktivel reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@Thirumalai-Shaktivel

Thirumalai-Shaktivel commented Apr 8, 2023

Copy link
Copy Markdown
Collaborator Author

Thanks of the approvals!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@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

Reviewers

@certik certik certik approved these changes
@czgdp1807 czgdp1807 czgdp1807 approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

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

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@Thirumalai-Shaktivel @certik @czgdp1807
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.