]> git.eshelyaron.com Git - emacs.git/commitdiff
Use max_align_t instead of void *
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 24 Dec 2016 02:28:44 +0000 (18:28 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 24 Dec 2016 02:29:13 +0000 (18:29 -0800)
* src/thread.c (run_thread): Don’t assume void * is aligned enough.

src/thread.c

index 3f9595274e971b9e6a8080c7ddb72565616ab399..0bb0b7e006ae2b8cacfa12895d851cd0d75d6500 100644 (file)
@@ -645,17 +645,12 @@ run_thread (void *state)
 {
   /* Make sure stack_top and m_stack_bottom are properly aligned as GC
      expects.  */
-  union
-  {
-    void *p;
-    char c;
-  } stack_pos;
+  max_align_t stack_pos;
 
   struct thread_state *self = state;
   struct thread_state **iter;
 
-  self->m_stack_bottom = &stack_pos.c;
-  self->stack_top = &stack_pos.c;
+  self->m_stack_bottom = self->stack_top = (char *) &stack_pos;
   self->thread_id = sys_thread_self ();
 
   acquire_global_lock (self);