Is it possible to switch off optimization of a specific function? A friend of mine has the problem that the gcc optimization makes some (unknown to me) µ-controller-code not
If the pragma won't work for you, try splitting the function into its own file, and then compile that file without the optimisation flag set.