From Bugzilla Helper: User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020606 Description of problem: These two functions should generate much more similar assembly. Version-Release number of selected component (if applicable): How reproducible: Always Steps to Reproduce: 1.Take the example file, testswitch.cxx 2.g++ -pipe -march=athlon -mcpu=athlon -O2 -S testswitch.cxx 3.Look at testswitch.s and see how assembly output for functions test and test2 are pretty different. Additional info: gcc-c++-2.96-112
Created attachment 69226 [details] Source file to compile to reproduce
Created attachment 69227 [details] The assembly language output
This is certainly nothing which will change in 2.96-RH, as it is in important bugfixes mode only. If you get the same behaviour with gcc 3.3, file an enhancement request at http://gcc.gnu.org/gnats.html.
Well, I would love to test it on gcc 3.3 or something similar, but those things aren't available in a standard non-beta distribution yet. In fact AFAIK, gcc 3.3 isn't even released yet. It seems odd to me that I should have to download and hand-build the unstable CVS tree for a compiler simply so I can report a case of inadequate optimization. Of course, the differences between 2.96 and 3.2 in the optimization department are rather marked. So if you insist I try it in a 3.2 version when RH 8.0 comes out, I'll do so.
Well, at least 3.1 is available for 7.3 as secondary compiler (there is a special RHN channel for it), so you can check that. The point in filing PR in gcc GNATS is that your enhancement request will get there greater audience.