Skip to content

C backend: variable is initialized twice #1626

Closed
@certik

Description

@certik

Example:

from ltypes import f64

def f() -> f64:
    return 5.5

def main():
    t1: f64 = f()*1e6
    print(t1)

main()

This generates:

$ lpython --show-c a.py
...
void _xx_lcompilers_changed_main_xx()
{
    double t1 = f()*  1.00000000000000000e+06;
    t1 = f()*  1.00000000000000000e+06;
    printf("%lf\n", t1);
}
...

Which is wrong, it should only be initialized once.

Metadata

Metadata

Assignees

Labels

cLabel for C language related changeshigh priorityThe issue is blocking other projects, not easy to workaround, must be fixed as soon as possible

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions