Whether there is a problem with the program, some programs have logical errors, but there will be no errors in compilation. You might as well write a delay timer program and simulate it separately.
Some simulation software will not recognize some temporary variables.
Or you can send me the program and I'll try to simulate it.