Skip to content

Fix: ForRangeLoopStmt body pop is silently discarded without null check #243

@yuvimittal

Description

@yuvimittal

Summary

The body result is popped with _ = self.result_stack.pop() — no safe_pop, no guard. If the loop body is a block that terminates early (return/break) without pushing a value, this raises IndexError and leaks IR state. The ForCountLoopStmt has the same pattern with _body_val.

OS / Environment

-

Steps to Reproduce

File Upload (optional)

No response

Expected Results

Actual Results

-

IRx version

-

Code of Conduct

  • I agree to follow the Code of Conduct

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood first issueGood for newcomers

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions