This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug other/43449] New: sbitmap is broken if gcc is built with -m32 on a 64-bit machine.
- From: "dougkwan at google dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Mar 2010 20:54:21 -0000
- Subject: [Bug other/43449] New: sbitmap is broken if gcc is built with -m32 on a 64-bit machine.
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
We found a problem in sbitmap.c:
bool
sbitmap_range_empty_p (const_sbitmap bmap, unsigned int start, unsigned int n)
{
unsigned int i = start / SBITMAP_ELT_BITS;
SBITMAP_ELT_TYPE elm;
...
/* The bits are totally contained in a single element. */
if (shift + n < SBITMAP_ELT_BITS)
elm &= ((1 << n) - 1);
depending on configuration, SBITMAP_ELT_TYPE can be wider than the int type.
The masking above will mistakenly strip off top bits from elm. The correct
code should be written as:
/* The bits are totally contained in a single element. */
if (shift + n < SBITMAP_ELT_BITS)
elm &= (((SBITMAP_ELF_BITS) 1 << n) - 1);
The same problem appears in another location of the same function. The broken
code is in both 4.4.0 and trunk.
--
Summary: sbitmap is broken if gcc is built with -m32 on a 64-bit
machine.
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: other
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dougkwan at google dot com
GCC build triplet: x86_64-unknown-linux-gnu
GCC host triplet: x86_64-unknown-linux-gnu (with -m32)
GCC target triplet: arm-none-eabi
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43449