This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/67781] [5/6 Regression] wrong code generated on big-endian with -O1 -fexpensive-optimizations


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67781

--- Comment #7 from Thomas Preud'homme <thopre01 at gcc dot gnu.org> ---
The exact place where it goes wrong is in find_bswap_or_nop (not the _1 helper
function) in the following line:

      for (tmpn = n->n, rsize = 0; tmpn; tmpn >>= BITS_PER_MARKER, rsize++);

This code removes the most significant zero on little endian systems but the
least significant one on big endian ones, changing the value in n->n. It should
do some left shift but be careful of undefined behavior.

Actually, this makes me realize that we only remove the most significant zeros
but the least significant ones would be fine too if the base address is
adjusted.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]