jenkinsci / jenkinsci/workflow-cps-plugin

[JENKINS-70008] CPS-transformed "for" with empty termination never loops (should always)

Open
#1,646 0 comments 0 reactions 0 assignees View on GitHub
component:workflow-cps-plugin imported-jira-issue priority:minor resolution:unresolved
Dominant language
Java
Stars
186
Forks
213
Avg merge
12h 12m
Merged PRs (30d)
8

Description

An empty "for" termination is always looped (treated as true).

for (;;) {

// infinite loop
}

CPS transformed version never loops. Test for CpsTransformerTest currently fails:

    @​Test

public void emptyForCondition() throws Throwable {
assertEvaluate(true,
"boolean looped = false;\n"+
"for (;;) { looped = true; break; }\n"+
"looped");
}

---
Originally reported by vallon, imported from: CPS-transformed "for" with empty termination never loops (should always)


  • status: Open
  • priority: Minor
  • component(s): workflow-cps-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 1
  • imported: 2025-12-07

Raw content of original issue

An empty "for" termination is always looped (treated as true).


for (;;) {

// infinite loop
}

CPS transformed version never loops. Test for CpsTransformerTest currently fails:


    @Test

public void emptyForCondition() throws Throwable {
assertEvaluate(true,
"boolean looped = false;\n"+
"for (;;) { looped = true; break; }\n"+
"looped");
}

  • environment: groovy-cps/master bd35d05

Contributor guide

Open the contributing guide

Research direction

Start with the failing emptyForCondition test in CpsTransformerTest and trace how the CPS transformation handles a for loop with an empty condition. Confirm the expected behavior from the test, then make the test pass so the empty condition is treated as true and the loop executes.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.