Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

do-while loop continue label incorrect #175

Open
sim642 opened this issue Nov 5, 2024 · 1 comment
Open

do-while loop continue label incorrect #175

sim642 opened this issue Nov 5, 2024 · 1 comment
Labels

Comments

@sim642
Copy link
Member

sim642 commented Nov 5, 2024

A simple do-while loop like

  do {
    i++;
  } while (i < 10);

is converted to the following (according to Goblint's justcil):

  {
#line 6
  while (1) {
    while_continue: /* CIL Label */ ;
#line 7
    i ++;
#line 6
    if (! (i < 10)) {
#line 6
      goto while_break;
    }
  }
  while_break: /* CIL Label */ ;
  }

The location of while_continue label there is wrong! According to cppreference, it should be like:

do {
    // ... 
    continue; // acts as goto contin;
    // ... 
    contin:;
} while (/* ... */);
@sim642 sim642 added the bug label Nov 5, 2024
@michael-schwarz
Copy link
Member

Wow! Amazing this was only discovered after almost 2 decades of CIL!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants