Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • sac2c sac2c
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 395
    • Issues 395
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 11
    • Merge requests 11
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • sac-group
  • sac2csac2c
  • Issues
  • #2506
Closed
Open
Created Sep 12, 2025 by Sven-Bodo Scholz@sbsOwner

weird loop bug

Both variants of the below code fail:

int main()
{
   i = 1;
   while ( _gt_SxS_(i, 0) ) {
#if 1
       i = _add_SxS_(i,1);
#else
       i = _mul_SxS_(2,i);
#endif
   }
   return i;
}

sac2c -noprelude using sac2c 2.0.0-Tintigny-181-ge8f88 yields:

a return value of 2 in the addition version

a non-terminating program in the multiplication version

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking