A piece of C code was creating core dump.
When i simply added a few fprintf statement and printed the value of variales used in code to a file, surprisingly the code ran successfully.
I tried the scenario number of times and the result was same "when fprintf was present no core dump and when absent core dump"
Please note that the input was same in both case.
What could be the reason?
Can it be due to compiler optimization?
I am using gcc compiler and the platform is linux.