aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorStephane Carrez <stcarrez@worldnet.fr>1999-10-14 12:21:27 +0200
committerJeff Law <law@gcc.gnu.org>1999-10-14 04:21:27 -0600
commit9180cca3e10d1001bd99afb8a2544405d688d2e5 (patch)
tree876b4e77c1c1ce12b309b934741da38cfaf70d54 /gcc
parent25238622ec79cceb912a1382ff9afffb680aea0a (diff)
downloadgcc-9180cca3e10d1001bd99afb8a2544405d688d2e5.zip
gcc-9180cca3e10d1001bd99afb8a2544405d688d2e5.tar.gz
gcc-9180cca3e10d1001bd99afb8a2544405d688d2e5.tar.bz2
stor-layout.c (layout_union): Use HOST_WIDE_INT for const_size...
* stor-layout.c (layout_union): Use HOST_WIDE_INT for const_size; check for member bit-size overflow and use var_size if it occurs. (layout_record): Use bitsize_int() to define the type size in bits. Likewise for computation and assignment to DECL_FIELD_BITPOS. (layout_decl): Likewise when assigning to DECL_SIZE. From-SVN: r29969
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/stor-layout.c25
2 files changed, 23 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f126607..48c6a9d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+Thu Oct 14 03:59:57 1999 Stephane Carrez <stcarrez@worldnet.fr>
+
+ * stor-layout.c (layout_union): Use HOST_WIDE_INT for const_size;
+ check for member bit-size overflow and use var_size if it occurs.
+ (layout_record): Use bitsize_int() to define the type size in bits.
+ Likewise for computation and assignment to DECL_FIELD_BITPOS.
+ (layout_decl): Likewise when assigning to DECL_SIZE.
+
Thu Oct 14 02:57:05 1999 Richard Henderson <rth@cygnus.com>
* genrecog.c (validate_pattern): Typo last change. Verify
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 1986074..f8a1e1d 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -261,8 +261,8 @@ layout_decl (decl, known_align)
if (spec_size == 0 && DECL_NAME (decl) != 0)
abort ();
- /* Size is specified number of bits. */
- DECL_SIZE (decl) = size_int (spec_size);
+ /* Size is specified in number of bits. */
+ DECL_SIZE (decl) = bitsize_int (spec_size, 0);
}
/* Force alignment required for the data type.
But if the decl itself wants greater alignment, don't override that.
@@ -298,7 +298,7 @@ layout_decl (decl, known_align)
DECL_ALIGN (decl) = MAX ((unsigned) GET_MODE_ALIGNMENT (xmode),
DECL_ALIGN (decl));
DECL_MODE (decl) = xmode;
- DECL_SIZE (decl) = size_int (GET_MODE_BITSIZE (xmode));
+ DECL_SIZE (decl) = bitsize_int (GET_MODE_BITSIZE (xmode), 0);
/* This no longer needs to be accessed as a bit field. */
DECL_BIT_FIELD (decl) = 0;
}
@@ -517,7 +517,7 @@ layout_record (rec)
DECL_FIELD_BITPOS (field) = var_size;
else
{
- DECL_FIELD_BITPOS (field) = size_int (const_size);
+ DECL_FIELD_BITPOS (field) = bitsize_int (const_size, 0L);
/* If this field ended up more aligned than we thought it
would be (we approximate this by seeing if its position
@@ -559,7 +559,7 @@ layout_record (rec)
if (var_size == 0)
{
- TYPE_SIZE (rec) = size_int (const_size);
+ TYPE_SIZE (rec) = bitsize_int (const_size, 0L);
}
else
{
@@ -607,7 +607,7 @@ layout_union (rec)
/* The size of the union, based on the fields scanned so far,
is max (CONST_SIZE, VAR_SIZE).
VAR_SIZE may be null; then CONST_SIZE by itself is the size. */
- register int const_size = 0;
+ register HOST_WIDE_INT const_size = 0;
register tree var_size = 0;
#ifdef STRUCTURE_SIZE_BOUNDARY
@@ -624,6 +624,8 @@ layout_union (rec)
for (field = TYPE_FIELDS (rec); field; field = TREE_CHAIN (field))
{
+ tree dsize;
+
/* Enums which are local to this class need not be laid out. */
if (TREE_CODE (field) == CONST_DECL || TREE_CODE (field) == TYPE_DECL)
continue;
@@ -642,19 +644,22 @@ layout_union (rec)
union_align = MAX (union_align, TYPE_ALIGN (TREE_TYPE (field)));
#endif
+ dsize = DECL_SIZE (field);
if (TREE_CODE (rec) == UNION_TYPE)
{
/* Set union_size to max (decl_size, union_size).
There are more and less general ways to do this.
Use only CONST_SIZE unless forced to use VAR_SIZE. */
- if (TREE_CODE (DECL_SIZE (field)) == INTEGER_CST)
+ if (TREE_CODE (dsize) == INTEGER_CST
+ && ! TREE_CONSTANT_OVERFLOW (dsize)
+ && TREE_INT_CST_HIGH (dsize) == 0)
const_size
- = MAX (const_size, TREE_INT_CST_LOW (DECL_SIZE (field)));
+ = MAX (const_size, TREE_INT_CST_LOW (dsize));
else if (var_size == 0)
- var_size = DECL_SIZE (field);
+ var_size = dsize;
else
- var_size = size_binop (MAX_EXPR, var_size, DECL_SIZE (field));
+ var_size = size_binop (MAX_EXPR, var_size, dsize);
}
else if (TREE_CODE (rec) == QUAL_UNION_TYPE)
var_size = fold (build (COND_EXPR, sizetype, DECL_QUALIFIER (field),