Thanks both of you, I hadn't considered using the volatile keyword to 'fix' some of the issue.
I also hadn't realized that complete control of compiler behavior wasn't available. It would explain a few things anyhow.
This definitively answered my question.
Thanks!
Stephen