I am having a problem with a kernel module that I work on. When any optimization is enabled my module crashes with what appears to be a stack related problem. However if I disable optimization I don’t have a problem. I have used gcc 4.1.0, 4.1.1 and 4.1.2 all with the same effect. Also the behavior is the same on the base release and SP1. This is only a problem on x86 and not on x86_64, s390x or Itanium. I have tried enabling the optimization options individually according to the gcc man page, but it runs fine in that case.
Does anybody know what exactly is enabled by gcc with the different optimization levels? Or perhaps has anybody seen a similar problem?