aboutsummaryrefslogtreecommitdiff
path: root/gcc/stor-layout.c
diff options
context:
space:
mode:
authorJim Wilson <wilson@cygnus.com>1999-10-30 00:18:23 +0000
committerJim Wilson <wilson@gcc.gnu.org>1999-10-29 17:18:23 -0700
commit501eb93c44acdb9c998aeed9f8e0f517a67ce940 (patch)
treee2a04191964ecf2b1c184baee12db28e24279123 /gcc/stor-layout.c
parent3071fab5054b156e506212b86c62d614bd10e284 (diff)
downloadgcc-501eb93c44acdb9c998aeed9f8e0f517a67ce940.zip
gcc-501eb93c44acdb9c998aeed9f8e0f517a67ce940.tar.gz
gcc-501eb93c44acdb9c998aeed9f8e0f517a67ce940.tar.bz2
Fix mn10200-elf libio build failure, and minor performance regression.
* stor-layout.c (layout_type): When compute TYPE_SIZE_UNIT from TYPE_SIZE, convert type of result to sizetype. From-SVN: r30270
Diffstat (limited to 'gcc/stor-layout.c')
-rw-r--r--gcc/stor-layout.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index f8a1e1d..3663293 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -1106,8 +1106,12 @@ layout_type (type)
of the type above, find it by division. */
if (TYPE_SIZE_UNIT (type) == 0 && TYPE_SIZE (type) != 0)
{
- TYPE_SIZE_UNIT (type) = size_binop (FLOOR_DIV_EXPR, TYPE_SIZE (type),
- size_int (BITS_PER_UNIT));
+ /* TYPE_SIZE (type) is computed in bitsizetype. After the division, the
+ result will fit in sizetype. We will get more efficient code using
+ sizetype, so we force a conversion. */
+ tree unit_size = size_binop (FLOOR_DIV_EXPR, TYPE_SIZE (type),
+ size_int (BITS_PER_UNIT));
+ TYPE_SIZE_UNIT (type) = convert (sizetype, unit_size);
}
/* Once again evaluate only once, either now or as soon as safe. */