summaryrefslogtreecommitdiff
path: root/gcc/varasm.c
diff options
context:
space:
mode:
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>1999-11-18 07:57:32 +0000
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>1999-11-18 07:57:32 +0000
commit727624f686f4917621880e07d0782293159ce9b6 (patch)
tree37845075fd4f70413bea7f65b66b9d236d72217d /gcc/varasm.c
parentf06a62a89a4583bf15d7708507118ca6e0104c89 (diff)
downloadgcc-727624f686f4917621880e07d0782293159ce9b6.tar.gz
* varasm.c (output_constructor) Solved problem with long long
bitfields. Corrected calculating this_time and shift. Also corrected calculating mask when BITS_PER_UNIT == 32 (c4x). git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@30571 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r--gcc/varasm.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 800465b9b5f..e3b0996032d 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -4530,12 +4530,13 @@ output_constructor (exp, size)
and put them into bytes from the most significant end. */
shift = end_offset - next_offset - this_time;
/* Don't try to take a bunch of bits that cross
- the word boundary in the INTEGER_CST. */
+ the word boundary in the INTEGER_CST. We can
+ only select bits from the LOW or HIGH part
+ not from both. */
if (shift < HOST_BITS_PER_WIDE_INT
&& shift + this_time > HOST_BITS_PER_WIDE_INT)
{
- this_time -= (HOST_BITS_PER_WIDE_INT - shift);
- shift = HOST_BITS_PER_WIDE_INT;
+ this_time = (HOST_BITS_PER_WIDE_INT - shift);
}
/* Now get the bits from the appropriate constant word. */
@@ -4550,8 +4551,10 @@ output_constructor (exp, size)
}
else
abort ();
+ /* Get the result. This works only when:
+ 1 <= this_time <= HOST_BITS_PER_WIDE_INT. */
byte |= (((value >> shift)
- & (((HOST_WIDE_INT) 1 << this_time) - 1))
+ & (((HOST_WIDE_INT) 2 << (this_time - 1)) - 1))
<< (BITS_PER_UNIT - this_time - next_bit));
}
else
@@ -4563,12 +4566,13 @@ output_constructor (exp, size)
shift = (next_offset
- TREE_INT_CST_LOW (DECL_FIELD_BITPOS (field)));
/* Don't try to take a bunch of bits that cross
- the word boundary in the INTEGER_CST. */
+ the word boundary in the INTEGER_CST. We can
+ only select bits from the LOW or HIGH part
+ not from both. */
if (shift < HOST_BITS_PER_WIDE_INT
&& shift + this_time > HOST_BITS_PER_WIDE_INT)
{
- this_time -= (HOST_BITS_PER_WIDE_INT - shift);
- shift = HOST_BITS_PER_WIDE_INT;
+ this_time = (HOST_BITS_PER_WIDE_INT - shift);
}
/* Now get the bits from the appropriate constant word. */
@@ -4581,8 +4585,10 @@ output_constructor (exp, size)
}
else
abort ();
+ /* Get the result. This works only when:
+ 1 <= this_time <= HOST_BITS_PER_WIDE_INT. */
byte |= (((value >> shift)
- & (((HOST_WIDE_INT) 1 << this_time) - 1))
+ & (((HOST_WIDE_INT) 2 << (this_time - 1)) - 1))
<< next_bit);
}
next_offset += this_time;