Skip to content

Bug C backend: For loops u64 #1887

Open
@ronnuriel

Description

@ronnuriel

Error in for loop:

from lpython import (
    i8, i16, u16, i32, i64, u64, u16,
    ccall, ccallback, overload,
    CPtr, c_p_pointer, Pointer,
    packed, dataclass, sizeof,
)
t: u64 = u64(10)
num_iters: u64 = t
i: u64
for i in range(num_iters):
    print(i)

Error:

semantic error: Type mismatch in loop start and loop end values, the types must be compatible
  --> testlpython.py:10:1 - 11:12
   |
10 |    for i in range(num_iters):
   |    ^^^^^^^^^^^^^^^^^^^^^^^^^^...
...
   |
11 |        print(i)
   | ...^^^^^^^^^^^^ type mismatch ('i64' and 'u64')
   |
10 | for i in range(num_iters):
   |                ^^^^^^^^^ type mismatch ('i64' and 'u64')

Metadata

Metadata

Assignees

Labels

cLabel for C language related changes

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions