Skip to content

Print for loops with the CompCert guard orientation - #876

Merged
andrew-appel merged 1 commit into
PrincetonUniversity:masterfrom
remix7531:for-loop-orientation
Nov 9, 2026
Merged

andrew-appel merged 1 commit into
PrincetonUniversity:masterfrom
remix7531:for-loop-orientation

Conversation

@remix7531

Copy link
Copy Markdown
Contributor

The for (; e; step) printing notation matched Sifthenelse e Sbreak Sskip, a loop that stops when e holds, so it printed such loops with the condition inverted. CompCert's Swhile and Sfor expand to Sifthenelse e Sskip Sbreak, which this matches instead. Loops from clightgen now print as for (; _i < _n; ...) instead of a generic loop with if (! _i < _n) { break; } inside.

Tested on Rocq 9.1.1 at both bit sizes: make vst, make test and make assumptions.txt pass with unchanged assumptions.

The specialized for-loop notation printed a guard that breaks when true
as a continuing condition. Match Sifthenelse guard Sskip Sbreak instead,
as CompCert's Swhile and Sfor expand. The opposite orientation still
prints as the generic loop containing its conditional break.
@andrew-appel
andrew-appel merged commit 47cb003 into PrincetonUniversity:master Nov 9, 2026
@remix7531
remix7531 deleted the for-loop-orientation branch November 9, 2026 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants