Skip to content

Initialization at declaration #626

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

Open
certik opened this issue Jun 18, 2022 · 2 comments
Open

Initialization at declaration #626

certik opened this issue Jun 18, 2022 · 2 comments

Comments

@certik
Copy link
Contributor

certik commented Jun 18, 2022

Currently often code like x: i32 = 5 and x: i32[3] = empty(3) and such fails.

These are taken care of using expr? symbolic_value, expr? value members of Variable_t. We should rename these, perhaps to initial_value or something like that to make it clear, and document what the difference is between the two (I forgot).

We should go over all combinations of such initializations and make sure they all work, I think there are quite a few cases that don't work yet.

There is one more complication. In Fortran, the above is used for code like:

integer :: x = 5

Which in Fortran implies integer, save :: x = 5, the save attributed is represented by the storage_type = Save member of Variable_t. For Python, code like x: i32 = 5 should still store the initial value in Variable_t, but use storage_type = Default. Then in the LLVM backend we need to support both storage_types.

@czgdp1807
Copy link
Collaborator

czgdp1807 commented Jun 18, 2022

Yes. This is a problem with LLVM. Though not a problem with C++/C backends.

@czgdp1807
Copy link
Collaborator

I will fix the initialisation at declaration issue on Monday.

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

No branches or pull requests

2 participants