diff options
| author | Jim Blandy | 1993-02-23 11:49:39 +0000 |
|---|---|---|
| committer | Jim Blandy | 1993-02-23 11:49:39 +0000 |
| commit | 6d19f28ad1e387810e635e434377f8016ab369b7 (patch) | |
| tree | 21549c9af3f4538d126739be8d7e251c58b62512 /src/alloc.c | |
| parent | 57e83cfeff9b98c81790d0a01693f6db75b9cade (diff) | |
| download | emacs-6d19f28ad1e387810e635e434377f8016ab369b7.tar.gz 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.c | 23 |
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) | |||
| 991 | double num; | 991 | double num; |
| 992 | { | 992 | { |
| 993 | register Lisp_Object new; | 993 | register Lisp_Object new; |
| 994 | int alignment; | ||
| 995 | 994 | ||
| 996 | /* Make sure that pureptr is aligned on at least a sizeof (double) | 995 | /* Make sure that PUREBEG + pureptr is aligned on at least a sizeof |
| 997 | boundary. Some architectures (like the sparc) require this, and | 996 | (double) boundary. Some architectures (like the sparc) require |
| 998 | I suspect that floats are rare enough that it's no tragedy for | 997 | this, and I suspect that floats are rare enough that it's no |
| 999 | those that do. */ | 998 | tragedy for those that do. */ |
| 999 | { | ||
| 1000 | int alignment; | ||
| 1001 | char *p = PUREBEG + pureptr; | ||
| 1002 | |||
| 1000 | #ifdef __GNUC__ | 1003 | #ifdef __GNUC__ |
| 1001 | #if __GNUC__ >= 2 | 1004 | #if __GNUC__ >= 2 |
| 1002 | alignment = __alignof (struct Lisp_Float); | 1005 | alignment = __alignof (struct Lisp_Float); |
| 1003 | #else | 1006 | #else |
| 1004 | alignment = sizeof (struct Lisp_Float); | 1007 | alignment = sizeof (struct Lisp_Float); |
| 1005 | #endif | 1008 | #endif |
| 1006 | #else | 1009 | #else |
| 1007 | alignment = sizeof (struct Lisp_Float); | 1010 | alignment = sizeof (struct Lisp_Float); |
| 1008 | #endif | 1011 | #endif |
| 1009 | pureptr = (pureptr + alignment - 1) & - alignment; | 1012 | p = (char *) (((unsigned long) p + alignment - 1) & - alignment); |
| 1013 | pureptr = p - PUREBEG; | ||
| 1014 | } | ||
| 1010 | 1015 | ||
| 1011 | if (pureptr + sizeof (struct Lisp_Float) > PURESIZE) | 1016 | if (pureptr + sizeof (struct Lisp_Float) > PURESIZE) |
| 1012 | error ("Pure Lisp storage exhausted"); | 1017 | error ("Pure Lisp storage exhausted"); |