Cause

There is a constraint that prevents you from inserting a break statement inside a do-while loop in CT 2024.12.

Solution

Replace the break statement with a goto statement.

Example

int test(){
int i=0;
int a=10;
int b= 20;
do{
  i++;
}while(1);
return a+b;
}

In the example code, if you try to escape the loop statement with break; via fault injection feature, you get an error


In this case, you can escape the loop statement by replacing break; with goto.

Need more help with this?
Don’t hesitate to contact us here.

Thanks for your feedback.