Loops in PLCs are usually not good. You have to make sure you understand how the PLC scan works, along with loops.
Your code block is probably yielding. This is how I/O scans can be "fast" but still allow looping. Your timers MUST execute EVERY scan in order to time correctly. You probably have your tmr/loops in a code block outside of $Main.
$Main defaults to NEVER yield, so all loops will execute completely, and your TMRs would hence always execute every PLC scan. But other code bocks default to yield every 100uSec - that means that if a loop takes longer than that, the PLC scan will continue with the next code block and finish the I/O ladder scan (realtime control is critical). The very next PLC scan, when it hits this looping code block again, it continues at the for/next loop, skipping all your TMR boxes, hence they do not time. This is why that warning exists.
If you click on the W331 Program Check rule, then hit the F1 key or hit the Item Help button, you will see some explanation.
Help topic DMD0231 Code Block Overview explains it some more.
There are some power point training slides that help explain the plc scan behavior when using loops.
https://hosteng.com/FAQFiles/TechSlides/TechTrainingSlides01.htmlGo there and look at presentation #8 - Instruction Set (Program-Looping)
Your solution may to just change the .TimeSlice of your code block to 65535 (special value that means
never yielding) - but this could greatly slow down your I/O scan if the loops are huge or nested. Otherwise, you may need to separate your looping logic from your timing/control logic in different code blocks, utilizing the fact that your looping code block may take many PLC scans to "finish".
PLCs are meant to scan I/O and execute logic. Long loops, while permitted, can cause long scan times or possibly watchdog timeouts. Looping in PLC logic can be done, but not like in normal programming languages.
If you need more help, please explain what you are doing with your loops and hopefully we can figure out how to make it work.