summaryrefslogtreecommitdiff
path: root/src/alloc.c
diff options
context:
space:
mode:
authorJim Blandy <jimb@redhat.com>1993-02-23 11:49:39 +0000
committerJim Blandy <jimb@redhat.com>1993-02-23 11:49:39 +0000
commit6d19f28ad1e387810e635e434377f8016ab369b7 (patch)
tree21549c9af3f4538d126739be8d7e251c58b62512 /src/alloc.c
parent57e83cfeff9b98c81790d0a01693f6db75b9cade (diff)
downloademacs-6d19f28ad1e387810e635e434377f8016ab369b7.tar.gz
emacs-6d19f28ad1e387810e635e434377f8016ab369b7.tar.bz2
emacs-6d19f28ad1e387810e635e434377f8016ab369b7.zip
* alloc.c (make_pure_float): Assure that PUREBEG + pureptr is
aligned, not pureptr itself.
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/alloc.c b/src/alloc.c
index f3010dbac5d..476ca817ba8 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -991,22 +991,27 @@ make_pure_float (num)
double num;
{
register Lisp_Object new;
- int alignment;
- /* Make sure that pureptr is aligned on at least a sizeof (double)
- boundary. Some architectures (like the sparc) require this, and
- I suspect that floats are rare enough that it's no tragedy for
- those that do. */
+ /* Make sure that PUREBEG + pureptr is aligned on at least a sizeof
+ (double) boundary. Some architectures (like the sparc) require
+ this, and I suspect that floats are rare enough that it's no
+ tragedy for those that do. */
+ {
+ int alignment;
+ char *p = PUREBEG + pureptr;
+
#ifdef __GNUC__
#if __GNUC__ >= 2
- alignment = __alignof (struct Lisp_Float);
+ alignment = __alignof (struct Lisp_Float);
#else
- alignment = sizeof (struct Lisp_Float);
+ alignment = sizeof (struct Lisp_Float);
#endif
#else
- alignment = sizeof (struct Lisp_Float);
+ alignment = sizeof (struct Lisp_Float);
#endif
- pureptr = (pureptr + alignment - 1) & - alignment;
+ p = (char *) (((unsigned long) p + alignment - 1) & - alignment);
+ pureptr = p - PUREBEG;
+ }
if (pureptr + sizeof (struct Lisp_Float) > PURESIZE)
error ("Pure Lisp storage exhausted");