This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Strangeness (maybe a bug?) in expmed.c: extract_bit_field_1()
- From: Jeff Kenton <jkenton at tilera dot com>
- To: <gcc-help at gcc dot gnu dot org>
- Date: Thu, 23 Jun 2011 10:55:21 -0400
- Subject: Strangeness (maybe a bug?) in expmed.c: extract_bit_field_1()
- References: <4E03410F.10201@agner.org> <4E034541.6090907@redhat.com>
In expmed.c: extract_bit_field_1() I see the following:
/* On big-endian machines, we count bits from the most significant.
If the bit field insn does not, we must invert. */
if (BITS_BIG_ENDIAN != BYTES_BIG_ENDIAN)
xbitpos = unit - bitsize - xbitpos;
This produces a negative value for xbitpos for BIG_ENDIAN code, despite
the fact that xbitpos is declared unsigned. The code in alpha/alpha.md
that it calls promptly converts the bit offset back to its original
value, and I have to do the same for my own BIG_ENDIAN port.
This smells like a bug, although I suspect changing it would break
existing ports.
Thoughts?
--jeff