Skip to content

Lowering of nested break/continue in loops #160

@yugr

Description

@yugr

Looks like currently CIRLoopOpLowering does not lower the nested break/continue statements within the lowered loop. For example this program

#include <stdio.h>

int foo(int n) {
  int s = 0, i;
  for (i = 1; i < n; ++i) {
    if (i == 1)
      break;
    ++s;
  }
  return s;
}

int main() {
  int s = foo(10);
  printf("%d\n", s);
  return 0;
}

prints 9 instead of expected 0.

Probably the best way to fix this is to scan body region inside CIRLoopLowering, replacing break/continue yields with BrOps?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions