aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Earnshaw <rearnsha@arm.com>2000-11-13 13:35:26 +0000
committerRichard Earnshaw <rearnsha@gcc.gnu.org>2000-11-13 13:35:26 +0000
commit373577962c7c6324ce0aa967088a736568a48e0c (patch)
tree43f40ee6c0644a2670e655822e337fdf50fb05d6 /gcc
parent26d4fec72e0319f2af9416ceaa9c76430b9e808d (diff)
downloadgcc-373577962c7c6324ce0aa967088a736568a48e0c.zip
gcc-373577962c7c6324ce0aa967088a736568a48e0c.tar.gz
gcc-373577962c7c6324ce0aa967088a736568a48e0c.tar.bz2
varasm.c (struct constant_descriptor): Put CONTENTS inside a union to make it well-aligned.
* varasm.c (struct constant_descriptor): Put CONTENTS inside a union to make it well-aligned. Update all uses. From-SVN: r37422
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/varasm.c22
2 files changed, 20 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c058f68..85cc062 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2000-11-13 Richard Earnshaw <rearnsha@arm.com>
+
+ * varasm.c (struct constant_descriptor): Put CONTENTS inside a
+ union to make it well-aligned. Update all uses.
+
2000-11-13 Joseph S. Myers <jsm28@cam.ac.uk>
* c-parse.in (initelt): Give appropriate pedantic warnings,
diff --git a/gcc/varasm.c b/gcc/varasm.c
index c422903..a6e65fd 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -2327,7 +2327,16 @@ struct constant_descriptor
struct constant_descriptor *next;
char *label;
rtx rtl;
- unsigned char contents[1];
+ /* Make sure the data is reasonably aligned. */
+ union
+ {
+ unsigned char contents[1];
+#ifdef HAVE_LONG_DOUBLE
+ long double d;
+#else
+ double d;
+#endif
+ } u;
};
#define HASHBITS 30
@@ -2477,7 +2486,7 @@ compare_constant (exp, desc)
tree exp;
struct constant_descriptor *desc;
{
- return 0 != compare_constant_1 (exp, desc->contents);
+ return 0 != compare_constant_1 (exp, desc->u.contents);
}
/* Compare constant expression EXP with a substring P of a constant descriptor.
@@ -3475,7 +3484,7 @@ compare_constant_rtx (mode, x, desc)
rtx x;
struct constant_descriptor *desc;
{
- register int *p = (int *) desc->contents;
+ register int *p = (int *) desc->u.contents;
register int *strp;
register int len;
struct rtx_const value;
@@ -3503,10 +3512,9 @@ record_constant_rtx (mode, x)
struct constant_descriptor *ptr;
ptr = ((struct constant_descriptor *)
- xcalloc (1,
- (sizeof (struct constant_descriptor)
- + sizeof (struct rtx_const) - 1)));
- decode_rtx_const (mode, x, (struct rtx_const *) ptr->contents);
+ xcalloc (1, (offsetof (struct constant_descriptor, u)
+ + sizeof (struct rtx_const))));
+ decode_rtx_const (mode, x, (struct rtx_const *) ptr->u.contents);
return ptr;
}