Linux 2.6.7-rc2
Quoted 4 lines · Peter Osterlund
If I put "#if 0" around the *wdata assignment in
nfs_writepage_sync, the stack usage goes down to 36, so it looks like gcc is building a temporary structure on the stack and then copies the whole thing to *wdata.
This would be required because of the -Wno-strict-aliasing option. For the 2.7.xx kernels, how about we start off by replacing -Wno-strict-aliasing with -std=gnu99 ? It's been 5 years since 1999. The "restrict" keyword is useful too.
Quoted 5 lines · Albert Cahalan
This would be required because of the -Wno-strict-aliasing option. For the 2.7.xx kernels, how about we start off by replacing -Wno-strict-aliasing with -std=gnu99 ? It's been 5 years since 1999. The "restrict" keyword is useful too.
No can do.
Aliasing in gcc is so broken (_purely_ type-based and no way to avoid it sanely in older versions) that it's not going to happen.
When we can depend on everybody having gcc-3.3+ something, and that one properly supports the "may_alias" attribute, we may change that.
"restrict" is pretty much useless. It just weakens the already too-weak alias rules of standard gcc.
Linus
Quoted 7 lines · Linus Torvalds
Quoted 5 lines · Albert Cahalan
This would be required because of the -Wno-strict-aliasing option. For the 2.7.xx kernels, how about we start off by replacing -Wno-strict-aliasing with -std=gnu99 ? It's been 5 years since 1999. The "restrict" keyword is useful too.
Quoted 7 lines
No can do.
Aliasing in gcc is so broken (_purely_ type-based and no way to avoid it sanely in older versions) that it's not going to happen.
When we can depend on everybody having gcc-3.3+ something, and that one properly supports the "
may_alias" attribute, we may change that.
By the time Linux 2.8.0 is out, gcc-3.3+ should be a perfectly reasonable requirement.
In the mean time, adding may_alias as needed would be a good idea.
If all this were behind CONFIG_BROKEN, it sure wouldn't hurt even today. People might as well get started. The compiler will keep being pessimistic and dumb until the -Wno-strict-aliasing option is dropped.
Quoted 2 lines
"restrict" is pretty much useless. It just weakens the already too-weak alias rules of standard gcc.
It's easiest to use on function parameters. This helps the optimizer without being a mind-warping excercise.