StartTask1() never reads returnValue. It could be that the compiler is simply not doing the store because it figures it's impossible for any code to ever get its value.
What difference does it make if returnValue is zero or not if the code never uses the value for anything?
Please DON'T delete your code after you've got the answer to your question. It makes this thread useless as a learning resource for others. It's a selfish abuse of this forum.
Please edit your OP to restore it with the original code.