https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67781
Steve Ellcey <sje at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-12-08
CC| |sje at gcc dot gnu.org
Component|rtl-optimization |tree-optimization
Ever confirmed|0 |1
--- Comment #2 from Steve Ellcey <sje at gcc dot gnu.org> ---
It looks like this is going wrong in the bswap pass (tree-ssa-math-opts.c) that
is only done with expensive optimizations. It also looks like it only affects
big-endian targets, but I think it affects all big-endian targets.
If I compile the test program with -O1 -fdump-tree-all
-fexpensive-optimizations
I get this code before the bswap pass:
main ()
{
uint32_t c;
unsigned int _2;
unsigned int _3;
unsigned char _4;
unsigned int _5;
<bb 2>:
_2 = s.a;
_3 = _2 << 8;
_4 = s.b;
_5 = (unsigned int) _4;
c_6 = _3 | _5;
printf ("%x\n", c_6);
return 0;
}
And this code after the bswap pass:
main ()
{
uint32_t c;
unsigned int _2;
unsigned int _3;
unsigned char _4;
unsigned int _5;
uint32_t * load_src_8;
<bb 2>:
load_src_8 = &s.a;
c_6 = MEM[(void *)load_src_8];
_2 = s.a;
_3 = _2 << 8;
_4 = s.b;
_5 = (unsigned int) _4;
printf ("%x\n", c_6);
return 0;
}