aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.h
diff options
context:
space:
mode:
authorGeoff Keating <geoffk@cygnus.com>2000-08-12 22:45:05 +0000
committerGeoffrey Keating <geoffk@gcc.gnu.org>2000-08-12 22:45:05 +0000
commit2f5c7f45225f826d430a25d4a54e9e19967d3a7c (patch)
treefa69ec89bc345170fcb966cb78d9c60d962957d3 /gcc/tree.h
parent808d8c417114a8df27fbc149f162e56f174783ac (diff)
downloadgcc-2f5c7f45225f826d430a25d4a54e9e19967d3a7c.zip
gcc-2f5c7f45225f826d430a25d4a54e9e19967d3a7c.tar.gz
gcc-2f5c7f45225f826d430a25d4a54e9e19967d3a7c.tar.bz2
tree.h (DECL_OFFSET_ALIGN): Make the off_align field of the tree structure an exponent rather than an...
* tree.h (DECL_OFFSET_ALIGN): Make the off_align field of the tree structure an exponent rather than an explicit alignment so it doesn't overflow. (SET_DECL_OFFSET_ALIGN): New macro. * stor-layout.c (place_union_field): Use SET_DECL_OFFSET_ALIGN rather than DECL_OFFSET_ALIGN. (place_field): Likewise. * expmed.c (store_bit_field): Abort on align==0 to avoid antisocial machine behaviour. From-SVN: r35659
Diffstat (limited to 'gcc/tree.h')
-rw-r--r--gcc/tree.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/tree.h b/gcc/tree.h
index 781ef43..e428a8a 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -1308,8 +1308,15 @@ struct tree_type
#define DECL_SIZE_UNIT(NODE) (DECL_CHECK (NODE)->decl.size_unit)
/* Holds the alignment required for the datum. */
#define DECL_ALIGN(NODE) (DECL_CHECK (NODE)->decl.u1.a.align)
-/* For FIELD_DECLs, holds the alignment that DECL_FIELD_OFFSET has. */
-#define DECL_OFFSET_ALIGN(NODE) (FIELD_DECL_CHECK (NODE)->decl.u1.a.off_align)
+/* For FIELD_DECLs, off_align holds the number of low-order bits of
+ DECL_FIELD_OFFSET which are known to be always zero.
+ DECL_OFFSET_ALIGN thus returns the alignment that DECL_FIELD_OFFSET
+ has. */
+#define DECL_OFFSET_ALIGN(NODE) \
+ (((unsigned HOST_WIDE_INT)1) << FIELD_DECL_CHECK (NODE)->decl.u1.a.off_align)
+/* Specify that DECL_ALIGN(NODE) is a multiple of X. */
+#define SET_DECL_OFFSET_ALIGN(NODE, X) \
+ (FIELD_DECL_CHECK (NODE)->decl.u1.a.off_align = exact_log2 ((X) & -(X)))
/* 1 if the alignment for this type was requested by "aligned" attribute,
0 if it is the default for this type. */
#define DECL_USER_ALIGN(NODE) (DECL_CHECK (NODE)->decl.user_align)