Wow, it looks like i opened the pandora box with this matter!
@MarkMLI if you raise it i would trully thank you for it, as the way you will expose the matter will be much more helpful for the dev than the way i could ever do it.
Just as a side note, my dad has been programming in pascal since around '85 in HP workstations and then with borland pascal, when i exposed the matter to him he raised his hands to the air and said: "Who used the for loop variable outside of the for loop? That's something you must never do! I for sure did not do it!"
Around 80% of our pascal code is his, but there have been other collaborators which probably introduced bad practices like that in our code base.
As a temporary solution, we will try to create a regular expression to look for any for loop variable thats used after the for loop, as checking the 3814 for statements is not practical.
Thank you very much everyone for your contributions and help in clarifying the issue!